質問編集履歴

2

修正

2018/12/07 05:23

投稿

t_san
t_san

スコア14

test CHANGED
File without changes
test CHANGED
@@ -4,23 +4,15 @@
4
4
 
5
5
  データベースはmysql(Sequel Pro)を使っています。
6
6
 
7
+
8
+
7
- 自動的につくられるpassword_reset_tableのージは存在しています。
9
+ ターミナルでphp artisan migrateのコマンドを入力すると以下のようなメッセージがでます。
8
10
 
9
11
 
10
12
 
11
13
 
12
14
 
13
- ### 発生している問題・エラーメッセージ
14
-
15
-
16
-
17
-
18
-
19
-
20
-
21
- エラーメッセージ
22
-
23
- ```PHP laravel
15
+ ```
24
16
 
25
17
  Migrating: 2014_10_12_000000_create_users_table
26
18
 

1

バージョン表記、マークダウンのcode機能、migrationの設定ファイルの追加

2018/12/07 05:22

投稿

t_san
t_san

スコア14

test CHANGED
@@ -1 +1 @@
1
- Laravel5のデータベースへのmigrationについて
1
+ Laravel5.7のデータベースへのmigrationについて
test CHANGED
@@ -1,6 +1,6 @@
1
1
  ### 前提・実現したいこと
2
2
 
3
- laravel5を使っているのですが、データベースへのmigrationができません。usersテーブルはできるのですが、password_reset_tableがmigrationできません。なぜでしょうか?
3
+ laravel5.7.14を使っているのですが、データベースへのmigrationができません。usersテーブルはできるのですが、password_reset_tableがmigrationできません。なぜでしょうか?
4
4
 
5
5
  データベースはmysql(Sequel Pro)を使っています。
6
6
 
@@ -20,13 +20,17 @@
20
20
 
21
21
  エラーメッセージ
22
22
 
23
+ ```PHP laravel
23
24
 
24
-
25
- Illuminate\Database\QueryException : SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists (SQL: create table `users` (`id` int unsigned not null auto_increment primary key, `name` varchar(255) not null, `email` varchar(255) not null, `email_verified_at` timestamp null, `password` varchar(255) not null, `remember_token` varchar(100) null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')
25
+ Migrating: 2014_10_12_000000_create_users_table
26
26
 
27
27
 
28
28
 
29
- at /Users/user/EC/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
29
+ Illuminate\Database\QueryException : SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'users' already exists (SQL: create table `users` (`id` int unsigned not null auto_increment primary key, `name` varchar(255) not null, `email` varchar(255) not null, `email_verified_at` timestamp null, `password` varchar(255) not null, `remember_token` varchar(100) null, `created_at` timestamp null, `updated_at` timestamp null) default character set utf8mb4 collate 'utf8mb4_unicode_ci')
30
+
31
+
32
+
33
+ at /Users/user/EC/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
30
34
 
31
35
  660| // If an exception occurs when attempting to run a query, we'll format the error
32
36
 
@@ -65,3 +69,89 @@
65
69
 
66
70
 
67
71
  Please use the argument -v to see more details.
72
+
73
+
74
+
75
+ ```
76
+
77
+
78
+
79
+
80
+
81
+ 2014_10_12_100000_create_password_resets_table.phpファイルの設定
82
+
83
+ ```
84
+
85
+ <?php
86
+
87
+
88
+
89
+ use Illuminate\Support\Facades\Schema;
90
+
91
+ use Illuminate\Database\Schema\Blueprint;
92
+
93
+ use Illuminate\Database\Migrations\Migration;
94
+
95
+
96
+
97
+ class CreatePasswordResetsTable extends Migration
98
+
99
+ {
100
+
101
+ /**
102
+
103
+ * Run the migrations.
104
+
105
+ *
106
+
107
+ * @return void
108
+
109
+ */
110
+
111
+ public function up()
112
+
113
+ {
114
+
115
+ Schema::create('password_resets', function (Blueprint $table) {
116
+
117
+ $table->string('email')->index();
118
+
119
+ $table->string('token');
120
+
121
+ $table->timestamp('created_at')->nullable();
122
+
123
+ });
124
+
125
+ }
126
+
127
+
128
+
129
+ /**
130
+
131
+ * Reverse the migrations.
132
+
133
+ *
134
+
135
+ * @return void
136
+
137
+ */
138
+
139
+ public function down()
140
+
141
+ {
142
+
143
+ Schema::dropIfExists('password_resets');
144
+
145
+ }
146
+
147
+ }
148
+
149
+
150
+
151
+ ```
152
+
153
+
154
+
155
+
156
+
157
+ よろしくお願いします。