| Total Complexity | 2 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 6 | class CreateNoteTable extends Migration |
||
| 7 | { |
||
| 8 | public function up() |
||
| 9 | { |
||
| 10 | Schema::create('notes', function (Blueprint $table) { |
||
| 11 | $table->increments('id'); |
||
| 12 | $table->boolean('published')->default(0); |
||
| 13 | $table->enum('type', ['general', 'delivery', 'payment']); |
||
| 14 | $table->boolean('cookies'); |
||
| 15 | $table->enum('level', ['info', 'warning', 'error']); |
||
| 16 | $table->timestamp('start_at')->nullable(); |
||
| 17 | $table->timestamp('end_at')->nullable(); |
||
| 18 | $table->timestamps(); |
||
| 19 | }); |
||
| 20 | |||
| 21 | Schema::create('note_translations', function (Blueprint $table) { |
||
| 22 | $table->increments('id'); |
||
| 23 | $table->integer('note_id')->unsigned(); |
||
| 24 | $table->string('locale'); |
||
| 25 | $table->string('content'); |
||
| 26 | |||
| 27 | $table->unique(['note_id', 'locale']); |
||
| 28 | $table->foreign('note_id')->references('id')->on('notes')->onDelete('cascade'); |
||
| 29 | }); |
||
| 30 | } |
||
| 31 | |||
| 32 | public function down() |
||
| 33 | { |
||
| 34 | Schema::dropIfExists('note_translations'); |
||
| 35 | Schema::dropIfExists('notes'); |
||
| 36 | } |
||
| 38 |