質問編集履歴
2
やってみたことの部分のHistoruiesをCustomersに変更しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -68,9 +68,9 @@
|
|
68
68
|
|
69
69
|
やってみたこと
|
70
70
|
|
71
|
-
class Create
|
71
|
+
class CreateCustomers < ActiveRecord::Migration[5.1] を
|
72
72
|
|
73
|
-
class Create
|
73
|
+
class CreateCustomers < ActiveRecord::Migration[5.0] にして
|
74
74
|
|
75
75
|
migrateしてみましたが変化はありませんでした。
|
76
76
|
|
1
記述したテーブルの変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,31 +24,39 @@
|
|
24
24
|
|
25
25
|
```ここに言語を入力
|
26
26
|
|
27
|
-
class Create
|
27
|
+
class CreateCustomers < ActiveRecord::Migration[5.1]
|
28
28
|
|
29
29
|
def change
|
30
30
|
|
31
|
-
create_table :
|
31
|
+
create_table :customers do |t|
|
32
32
|
|
33
|
-
t.in
|
33
|
+
t.string :email, null: false #メールアドレス
|
34
34
|
|
35
|
-
t.string :
|
35
|
+
t.string :email_for_index, null: false
|
36
36
|
|
37
|
-
t.string :
|
37
|
+
t.string :family_name, null: false
|
38
38
|
|
39
|
-
t.string :
|
39
|
+
t.string :given_name, null: false
|
40
40
|
|
41
|
-
t.in
|
41
|
+
t.string :family_name_kana, null: false
|
42
42
|
|
43
|
-
t.in
|
43
|
+
t.string :given_name_kana, null: false
|
44
44
|
|
45
|
+
t.string :nick_name, null: false
|
46
|
+
|
45
|
-
t.in
|
47
|
+
t.string :hashed_password
|
46
48
|
|
47
49
|
t.timestamps
|
48
50
|
|
49
51
|
end
|
50
52
|
|
53
|
+
|
54
|
+
|
55
|
+
add_index :customers, :email_for_index, unique: true
|
56
|
+
|
51
|
-
add_index :
|
57
|
+
add_index :customers, :nick_name, unique: true
|
58
|
+
|
59
|
+
add_index :customers, [ :family_name_kana, :given_name_kana ]
|
52
60
|
|
53
61
|
end
|
54
62
|
|