-
Notifications
You must be signed in to change notification settings - Fork 0
/
migrate.txt
140 lines (115 loc) · 3.89 KB
/
migrate.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
Schema::create('accounts', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->string('username')->unique()->nullable();
$table->string('email')->unique()->nullable();
$table->string('confirmation_code')->nullable();
$table->string('avatar_url')->nullable();
$table->boolean('is_verified')->default(false);
$table->string('password')->nullable();
$table->unsignedInteger('role')->default('1');
$table->rememberToken();
$table->timestamps();
});
$table->integer('account_id')->primary();
$table->longText('introduce')->nullable();
$table->longText('bio')->nullable();
$table->timestamps();
$table->integer('account_id')->primary();
$table->timestamps();
Schema::create('social_accounts', function (Blueprint $table) {
$table->integer('user_id');
$table->string('provider_user_id');
$table->string('provider');
$table->timestamps();
$table->foreign('user_id')->references('account_id')->on('students')->onDelete('cascade');
});
Schema::create('courses', function (Blueprint $table) {
$table->id();
$table->integer('instructor_id');
$table->string('name');
$table->longText('introduce');
$table->string('thumbnail_url')->nullable();
$table->float('price');
$table->timestamps();
$table->foreign('instructor_id')->references('account_id')->on('instructors');
});
Schema::create('sections', function (Blueprint $table) {
$table->id();
$table->integer('course_id');
$table->string('name');
$table->timestamps();
$table->foreign('course_id')->references('id')->on('courses')->onDelete('cascade');
});
Schema::create('lessons', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->integer('section_id');
$table->string('duration');
$table->string('video_url')->nullable();
$table->longText('info');
$table->timestamps();
});
Schema::create('quizzes', function (Blueprint $table) {
$table->id();
$table->string('name');
$table->integer('section_id');
$table->longText('question');
$table->timestamps();
});
Schema::create('answers', function (Blueprint $table) {
$table->id();
$table->integer('quiz_id');
$table->integer('is_true');
$table->string('content');
$table->timestamps();
});
Schema::create('nofitications', function (Blueprint $table) {
$table->uuid('id')->primary();
$table->string('type');
$table->morphs('notifiable');
$table->text('data');
$table->timestamp('read_at')->nullable();
$table->timestamps();
});
Schema::create('follows', function (Blueprint $table) {
$table->id();
$table->integer('instructor_id');
$table->integer('student_id');
$table->timestamps();
$table->foreign('student_id')->references('account_id')->on('students')->onDelete('cascade');
$table->foreign('instructor_id')->references('account_id')->on('instructors')->onDelete('cascade');
});
Schema::create('section_student', function (Blueprint $table) {
$table->integer('section_id');
$table->integer('student_id');
$table->float('highest_point')->nullable();
$table->integer('lesson_id')->nullable();
$table->timestamps();
$table->foreign('student_id')->references('account_id')->on('students')->onDelete('cascade');
});
Schema::create('course_student', function (Blueprint $table) {
$table->integer('course_id');
$table->integer('student_id');
$table->float('progress')->default(0.0);
$table->integer('section_id')->nullable();
$table->timestamps();
$table->foreign('student_id')->references('account_id')->on('students')->onDelete('cascade');
});
Schema::create('topics', function (Blueprint $table) {
$table->id();
$table->string('name')->unique();
$table->string('icon');
$table->timestamps();
});
Schema::create('favorite_topic', function (Blueprint $table) {
$table->integer('topic_id');
$table->integer('student_id');
$table->timestamps();
});
Schema::create('course_topic', function (Blueprint $table) {
$table->integer('course_id');
$table->integer('topic_id');
$table->timestamps();
$table->foreign('student_id')->references('account_id')->on('students')->onDelete('cascade');
});