1: <?php
2:
3: use Illuminate\Database\Schema\Blueprint;
4: use Illuminate\Database\Migrations\Migration;
5:
6: class CreatePagesTable extends Migration {
7:
8: /**
9: * Run the migrations.
10: *
11: * @access public
12: * @return void
13: */
14: public function up()
15: {
16: if (!Schema::hasTable('_db_pages'))
17: {
18: Schema::create('_db_pages', function ($table)
19: {
20: $table->increments('id');
21: $table->integer('table_id')->unsigned();
22: $table->integer('action_id')->unsigned();
23: $table->integer('view_id')->unsigned();
24: $table->integer('object_id')->unsigned();
25: $table->integer('page_type_id')->unsigned();
26: $table->integer('page_size')->unsigned(); //the size of a page (pagination) in a list view
27: $table->string('title', 50);
28: $table->string('slug', 50);
29: $table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
30: $table->timestamp('updated_at')->default('0000-00-00 00:00:00');
31: /*
32: $table->foreign('view_id')->references('id')->on('_db_views')->onDelete('cascade');
33: $table->foreign('table_id')->references('id')->on('_db_tables')->onDelete('cascade');
34: $table->foreign('action_id')->references('id')->on('_db_actions')->onDelete('cascade'); */
35: });
36: }
37: }
38:
39: /**
40: * Reverse the migrations.
41: *
42: * @access public
43: * @return void
44: */
45: public function down()
46: {
47: Schema::dropIfExists('_db_pages');
48: }
49:
50: }
51: