|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
use Illuminate\Database\Schema\Blueprint; |
|
4
|
|
|
use Illuminate\Database\Migrations\Migration; |
|
5
|
|
|
|
|
6
|
|
|
class ContentTable extends Migration |
|
7
|
|
|
{ |
|
8
|
|
|
|
|
9
|
|
|
/** |
|
10
|
|
|
* Run the migrations. |
|
11
|
|
|
* |
|
12
|
|
|
* @return void |
|
13
|
|
|
*/ |
|
14
|
|
|
public function up() |
|
15
|
|
|
{ |
|
16
|
|
|
Schema::create('content', function (Blueprint $table) { |
|
17
|
|
|
$table->increments('id'); |
|
18
|
|
|
$table->boolean('active')->default(false); |
|
19
|
|
|
$table->string('title')->nullable(); |
|
20
|
|
|
$table->text('short_description')->nullable(); |
|
21
|
|
|
$table->text('content')->nullable(); |
|
22
|
|
|
$table->string('meta_title')->nullable(); |
|
23
|
|
|
$table->string('meta_description')->nullable(); |
|
24
|
|
|
$table->string('meta_keywords')->nullable(); |
|
25
|
|
|
$table->string('slug'); |
|
26
|
|
|
$table->integer('shop_id')->unsigned()->nullable(); |
|
27
|
|
|
$table->foreign('shop_id')->references('id')->on('shop')->onDelete('cascade'); |
|
28
|
|
|
$table->integer('modified_by_user_id')->unsigned()->nullable(); |
|
29
|
|
|
$table->foreign('modified_by_user_id')->references('id')->on('user')->onDelete('set null'); |
|
30
|
|
|
$table->timestamps(); |
|
31
|
|
|
$table->unique(array('title','shop_id'), 'unique_content_title'); |
|
32
|
|
|
}); |
|
33
|
|
|
|
|
34
|
|
|
Schema::create('content_image', function (Blueprint $table) { |
|
35
|
|
|
$table->increments('id'); |
|
36
|
|
|
$table->integer('content_id')->unsigned(); |
|
37
|
|
|
$table->foreign('content_id')->references('id')->on('content')->onDelete('cascade'); |
|
38
|
|
|
; |
|
39
|
|
|
$table->string('file')->nullable(); |
|
40
|
|
|
$table->string('path')->nullable(); |
|
41
|
|
|
$table->integer('size')->nullable(); |
|
42
|
|
|
$table->string('extension')->nullable(); |
|
43
|
|
|
$table->integer('rank')->default(0); |
|
44
|
|
|
$table->string('tag')->nullable(); |
|
45
|
|
|
$table->integer('modified_by_user_id')->unsigned()->nullable(); |
|
46
|
|
|
$table->foreign('modified_by_user_id')->references('id')->on('user')->onDelete('set null'); |
|
47
|
|
|
$table->timestamps(); |
|
48
|
|
|
}); |
|
49
|
|
|
|
|
50
|
|
|
// Creates the users table |
|
51
|
|
|
Schema::create('content_group', function ($table) { |
|
52
|
|
|
$table->increments('id'); |
|
53
|
|
|
$table->boolean('active')->default(false); |
|
54
|
|
|
$table->integer('rank')->default(0); |
|
55
|
|
|
$table->string('title'); |
|
56
|
|
|
$table->string('tag')->nullable(); |
|
57
|
|
|
$table->string('meta_title')->nullable(); |
|
58
|
|
|
$table->string('meta_description')->nullable(); |
|
59
|
|
|
$table->string('meta_keywords')->nullable(); |
|
60
|
|
|
|
|
61
|
|
|
$table->integer('shop_id')->unsigned(); |
|
62
|
|
|
$table->foreign('shop_id')->references('id')->on('shop')->onDelete('cascade'); |
|
63
|
|
|
|
|
64
|
|
|
$table->string('slug'); |
|
65
|
|
|
$table->integer('modified_by_user_id')->unsigned()->nullable(); |
|
66
|
|
|
$table->foreign('modified_by_user_id')->references('id')->on('user')->onDelete('set null'); |
|
67
|
|
|
$table->unique(array('title','shop_id'), 'unique_content_group_title'); |
|
68
|
|
|
$table->timestamps(); |
|
69
|
|
|
}); |
|
70
|
|
|
|
|
71
|
|
|
|
|
72
|
|
|
Schema::table('content', function (Blueprint $table) { |
|
73
|
|
|
$table->integer('content_group_id')->unsigned()->nullable(); |
|
74
|
|
|
$table->foreign('content_group_id', 'c_content_group_id_fk')->references('id')->on('content_group')->onDelete('set null'); |
|
75
|
|
|
}); |
|
76
|
|
|
|
|
77
|
|
|
|
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* Reverse the migrations. |
|
82
|
|
|
* |
|
83
|
|
|
* @return void |
|
84
|
|
|
*/ |
|
85
|
|
|
public function down() |
|
86
|
|
|
{ |
|
87
|
|
|
// |
|
88
|
|
|
} |
|
89
|
|
|
} |
|
90
|
|
|
|