質問編集履歴

1

マイグレーションファイルの表示

2021/03/24 06:08

投稿

Yuu412
Yuu412

スコア37

test CHANGED
File without changes
test CHANGED
@@ -26,6 +26,96 @@
26
26
 
27
27
 
28
28
 
29
+ ### テーブル定義
30
+
31
+
32
+
33
+ ```database\migrations\2014_10_12_000000_create_users_table.php
34
+
35
+ public function up()
36
+
37
+ {
38
+
39
+ Schema::create('users', function (Blueprint $table) {
40
+
41
+ $table->increments('id');
42
+
43
+ $table->string('email')->unique();
44
+
45
+ $table->timestamp('email_verified_at');
46
+
47
+ $table->string('password');
48
+
49
+ $table->rememberToken();
50
+
51
+ $table->timestamps();
52
+
53
+ });
54
+
55
+ ```
56
+
57
+
58
+
59
+ ```database\migrations\2021_03_24_011505_create_hr_users_table.php
60
+
61
+ public function up()
62
+
63
+ {
64
+
65
+ Schema::create('hr_users', function (Blueprint $table) {
66
+
67
+ $table->increments('id');
68
+
69
+ $table->string('name');
70
+
71
+ $table->string('email')->unique();
72
+
73
+ $table->timestamp('email_verified_at');
74
+
75
+ $table->string('password');
76
+
77
+ $table->rememberToken();
78
+
79
+ $table->timestamps();
80
+
81
+ });
82
+
83
+ }
84
+
85
+ ```
86
+
87
+
88
+
89
+ ```database\migrations\2021_03_22_093546_create_videos_table.php
90
+
91
+ public function up()
92
+
93
+ {
94
+
95
+ Schema::create('videos', function (Blueprint $table) {
96
+
97
+ $table->increments('id');
98
+
99
+ $table->integer('st_id')->unsigned();
100
+
101
+ $table->integer('hr_id')->unsigned();
102
+
103
+ $table->timestamps();
104
+
105
+
106
+
107
+ $table->foreign('st_id')->references('id')->on('users')->onDelete('no action');
108
+
109
+ //$table->foreign('hr_id')->references('id')->on('hr_users')->onDelete('no action');
110
+
111
+ });
112
+
113
+ }
114
+
115
+ ```
116
+
117
+
118
+
29
119
  ### 実現したい親子関係
30
120
 
31
121
  ![イメージ説明](8b999e98126ec2dbd05ea47a02fc46bf.png)