| @@ 6-34 (lines=29) @@ | ||
| 3 | use Illuminate\Database\Migrations\Migration; |
|
| 4 | use Illuminate\Database\Schema\Blueprint; |
|
| 5 | ||
| 6 | class CreateDomainsTable extends Migration |
|
| 7 | { |
|
| 8 | /** |
|
| 9 | * Run the migrations. |
|
| 10 | * |
|
| 11 | * @return void |
|
| 12 | */ |
|
| 13 | public function up() |
|
| 14 | { |
|
| 15 | Schema::create('domains', function (Blueprint $table) { |
|
| 16 | $table->increments('id'); |
|
| 17 | $table->string('slug', 50)->unique(); |
|
| 18 | $table->integer('owner_id')->unsigned(); |
|
| 19 | $table->foreign('owner_id')->references('id')->on('users')->onDelete('cascade'); |
|
| 20 | $table->nullableTimestamps(); |
|
| 21 | $table->softdeletes(); |
|
| 22 | }); |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * Reverse the migrations. |
|
| 27 | * |
|
| 28 | * @return void |
|
| 29 | */ |
|
| 30 | public function down() |
|
| 31 | { |
|
| 32 | Schema::drop('domains'); |
|
| 33 | } |
|
| 34 | } |
|
| 35 | ||
| @@ 5-35 (lines=31) @@ | ||
| 2 | ||
| 3 | use Illuminate\Database\Migrations\Migration; |
|
| 4 | ||
| 5 | class CreateServiceTypesTable extends Migration |
|
| 6 | { |
|
| 7 | /** |
|
| 8 | * Run the migrations. |
|
| 9 | * |
|
| 10 | * @return void |
|
| 11 | */ |
|
| 12 | public function up() |
|
| 13 | { |
|
| 14 | Schema::create('service_types', function ($table) { |
|
| 15 | $table->increments('id'); |
|
| 16 | $table->integer('business_id')->unsigned(); |
|
| 17 | $table->foreign('business_id')->references('id')->on('businesses'); |
|
| 18 | $table->string('slug')->index(); |
|
| 19 | $table->string('name'); |
|
| 20 | $table->string('description'); |
|
| 21 | $table->nullableTimestamps(); |
|
| 22 | $table->softDeletes(); |
|
| 23 | }); |
|
| 24 | } |
|
| 25 | ||
| 26 | /** |
|
| 27 | * Reverse the migrations. |
|
| 28 | * |
|
| 29 | * @return void |
|
| 30 | */ |
|
| 31 | public function down() |
|
| 32 | { |
|
| 33 | Schema::drop('service_types'); |
|
| 34 | } |
|
| 35 | } |
|
| 36 | ||