| Total Complexity | 2 |
| Total Lines | 47 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class CreateFiltersTable extends Migration |
||
| 8 | { |
||
| 9 | /** |
||
| 10 | * Run the migrations. |
||
| 11 | * |
||
| 12 | * @return void |
||
| 13 | */ |
||
| 14 | public function up() |
||
| 15 | { |
||
| 16 | Schema::create($this->tablePrefix.'filters', function(Blueprint $table) { |
||
| 17 | $table->increments('id'); |
||
| 18 | $table->unsignedInteger('module_id'); |
||
| 19 | $table->unsignedInteger('domain_id')->nullable(); |
||
| 20 | $table->unsignedInteger('user_id')->nullable(); |
||
| 21 | $table->string('name'); |
||
| 22 | $table->string('type'); |
||
| 23 | $table->text('columns'); |
||
| 24 | $table->text('conditions')->nullable(); |
||
| 25 | $table->string('order_by')->nullable(); |
||
| 26 | $table->boolean('is_default')->default(false); |
||
| 27 | $table->boolean('is_public')->default(false); |
||
| 28 | $table->text('data')->nullable(); |
||
| 29 | $table->timestamps(); |
||
| 30 | |||
| 31 | // Foreign keys |
||
| 32 | $table->foreign('module_id') |
||
| 33 | ->references('id')->on($this->tablePrefix.'modules') |
||
| 34 | ->onDelete('cascade'); |
||
| 35 | |||
| 36 | $table->foreign('domain_id') |
||
| 37 | ->references('id')->on($this->tablePrefix.'domains') |
||
| 38 | ->onDelete('cascade'); |
||
| 39 | |||
| 40 | $table->foreign('user_id') |
||
| 41 | ->references('id')->on('users') |
||
| 42 | ->onDelete('cascade'); |
||
| 43 | }); |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Reverse the migrations. |
||
| 48 | * |
||
| 49 | * @return void |
||
| 50 | */ |
||
| 51 | public function down() |
||
| 54 | } |
||
| 55 | } |
||
| 56 |