Blame view

database/migrations/2018_04_30_000000_add_parent_column.php 1.21 KB
b7c7a5f6   Alexey Boroda   first commit
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
  <?php
  
  use Illuminate\Database\Migrations\Migration;
  
  class AddParentColumn extends Migration
  {
      /**
       * Run the migrations.
       *
       * @return void
       */
      public function up()
      {
          Schema::table('invoices', function ($table) {
              $table->integer('parent_id')->default(0);
          });
  
          Schema::table('revenues', function ($table) {
              $table->integer('parent_id')->default(0);
          });
  
          Schema::table('bills', function ($table) {
              $table->integer('parent_id')->default(0);
          });
  
          Schema::table('payments', function ($table) {
              $table->integer('parent_id')->default(0);
          });
      }
  
      /**
       * Reverse the migrations.
       *
       * @return void
       */
      public function down()
      {
          Schema::table('invoices', function ($table) {
              $table->dropColumn('parent_id');
          });
  
          Schema::table('revenues', function ($table) {
              $table->dropColumn('parent_id');
          });
  
          Schema::table('bills', function ($table) {
              $table->dropColumn('parent_id');
          });
  
          Schema::table('payments', function ($table) {
              $table->dropColumn('parent_id');
          });
      }
  }