1: <?php
2:
3: use Illuminate\Database\Schema\Blueprint;
4: use Illuminate\Database\Migrations\Migration;
5:
6: class CreateKeyFieldsTable extends Migration {
7:
8: 9: 10: 11: 12: 13:
14: public function up()
15: {
16: if (!Schema::hasTable('_db_key_fields'))
17: {
18: Schema::create('_db_key_fields', function ($table)
19: {
20: $table->increments('id')->unique();
21: $table->integer('key_id')->unsigned()->nullable();
22: $table->integer('order')->unsigned()->nullable();
23: $table->integer('pk_field_id')->unsigned()->nullable();
24: $table->integer('pk_display_field_id')->unsigned()->nullable();
25: $table->integer('fk_field_id')->unsigned()->nullable();
26: $table->integer('fk_display_field_id')->unsigned()->nullable();
27: $table->integer('key_type_id')->unsigned()->nullable();
28: $table->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
29: $table->timestamp('updated_at')->default('0000-00-00 00:00:00');
30: });
31: }
32: }
33:
34: 35: 36: 37: 38: 39:
40: public function down()
41: {
42: Schema::dropIfExists('_db_key_fields');
43: }
44:
45: }
46: