mega-commit: migrations, controllers, models, etc.

This commit is contained in:
Didier Slof 2022-12-08 09:30:07 +01:00
parent 9732135e90
commit 2c6745e812
Signed by: didier
GPG key ID: 01E71F18AA4398E5
70 changed files with 2124 additions and 400 deletions

View file

@ -19,6 +19,7 @@ return new class extends Migration
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->enum('role', ['default', 'employee', 'manage'])->default('default');
$table->rememberToken();
$table->timestamps();
});

View file

@ -1,36 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('failed_jobs', function (Blueprint $table) {
$table->id('failed_job_id');
$table->string('uuid')->unique();
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->longText('exception');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('failed_jobs');
}
};

View file

@ -19,8 +19,8 @@ return new class extends Migration {
$table->addColumn('string', 'address_city', ['length' => 255]);
$table->addColumn('string', 'address_state', ['length' => 255]);
$table->addColumn('string', 'address_zip', ['length' => 255]);
$table->addColumn('string', 'address_country', ['length' => 255]);
$table->foreignId('user_id')->constrained('users', 'user_id');
$table->addColumn('string', 'address_country', ['length' => 255])->default('Netherlands');
$table->addColumn('string', 'address_phone', ['length' => 255])->nullable();
});
}

View file

@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('cinemas', function (Blueprint $table) {
$table->id('cinema_id');
$table->timestamps();
$table->string('cinema_name');
$table->foreignId('address_id')->constrained('addresses', 'address_id');
$table->foreignId('user_id')->constrained('users', 'user_id'); // who created this cinema
$table->timestamp('cinema_open')->nullable();
$table->timestamp('cinema_close')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cinemas');
}
};

View file

@ -17,6 +17,7 @@ return new class extends Migration
$table->id('permission_id');
$table->timestamps();
$table->addColumn('string', 'permission_name', ['length' => 255]);
$table->addColumn('string', 'permission_description', ['length' => 511])->nullable();
$table->unique(['permission_name']);
});
}

View file

@ -16,10 +16,11 @@ return new class extends Migration
Schema::create('rooms', function (Blueprint $table) {
$table->id('room_id');
$table->timestamps();
$table->addColumn('string', 'room_name', ['length' => 255]);
$table->addColumn('integer', 'room_rows');
$table->addColumn('integer', 'room_columns');
$table->unique(['room_name']);
$table->string('room_name');
$table->integer('room_rows');
$table->integer('room_columns');
$table->foreignId('cinema_id')->constrained('cinemas', 'cinema_id');
$table->foreignId('user_id')->constrained('users', 'user_id'); // who created this room
});
}

View file

@ -17,7 +17,7 @@ return new class extends Migration
$table->id('showing_id');
$table->timestamps();
$table->dateTime('showing_start');
$table->dateTime('showing_end');
// no showing end time, that's implied by the movie length and 10 minutes between showings
$table->foreignId('movie_id')->constrained('movies', 'movie_id');
$table->foreignId('room_id')->constrained('rooms', 'room_id');
$table->foreignId('user_id')->constrained('users', 'user_id');

View file

@ -18,8 +18,9 @@ return new class extends Migration
$table->timestamps();
$table->foreignId('permission_id')->constrained('permissions', 'permission_id');
$table->foreignId('user_id')->constrained('users', 'user_id');
$table->date('user_permission_start');
$table->date('user_permission_end');
// end can be null to mark indefinitely
$table->date('user_permission_start')->useCurrent();
$table->date('user_permission_end')->nullable();
});
}

View file

@ -17,7 +17,7 @@ return new class extends Migration
$table->id('order_id');
$table->timestamps();
$table->addColumn('integer', 'order_number');
$table->addColumn('enum', 'order_status', ['values' => ['pending', 'paid', 'cancelled']]);
$table->enum('order_status', ['pending', 'paid', 'cancelled']);
$table->foreignId('user_id')->constrained('users', 'user_id');
$table->foreignId('billing_address_id')->constrained('addresses', 'address_id');
$table->unique(['order_number', 'user_id']);