Beta version

This commit is too large to list all changes.
This commit is contained in:
2020-06-27 00:32:33 +01:00
parent d15c0cb12f
commit 5a8c080a31
135 changed files with 8534 additions and 12774 deletions

View File

@@ -27,8 +27,7 @@ class CreateProfilesTable extends Migration
$table->foreign('userID')
->references('id')
->on('users')
->onDelete('cascade');
->on('users');
});
}

View File

@@ -31,6 +31,10 @@ class CreateApplicationsTable extends Migration
'DENIED'
])->default('STAGE_SUBMITTED');
$table->timestamps();
$table->foreign('applicantUserID')
->references('id')
->on('users');
});
}

View File

@@ -22,7 +22,9 @@ class CreateVotesTable extends Migration
]);
$table->timestamps();
$table->foreign('userID')->references('id')->on('users');
$table->foreign('userID')
->references('id')
->on('users');
});
}

View File

@@ -32,6 +32,10 @@ class CreateAppointmentsTable extends Migration
$table->boolean('userAccepted')->default(false);
$table->longText('meetingNotes')->nullable();
$table->timestamps();
$table->foreign('applicationID')
->references('id')
->on('applications');
});
}

View File

@@ -23,7 +23,10 @@ class CreateVacanciesTable extends Migration
$table->integer('vacancyCount')->default(3);
$table->timestamps();
$table->foreign('vacancyFormID')->references('id')->on('forms');
$table->foreign('vacancyFormID')
->references('id')
->on('forms');
});
}

View File

@@ -21,6 +21,10 @@ class CreateStaffProfilesTable extends Migration
$table->dateTime('resignationDate')->nullable();
$table->text('memberNotes')->nullable();
$table->timestamps();
$table->foreign('userID')
->references('id')
->on('users');
});
}

View File

@@ -18,6 +18,12 @@ class CreateResponsesTable extends Migration
$table->bigInteger('responseFormID')->unsigned();
$table->longText('responseData');
$table->timestamps();
// A better way would be to link responses directly to vacancies, that subsquently have a form
$table->foreign('responseFormID')
->references('id')
->on('forms');
});
}

View File

@@ -25,8 +25,5 @@ class ChangeFormStructureLength extends Migration
*/
public function down()
{
Schema::table('forms', function (Blueprint $schema){
$schema->string('formStructure')->change();
});
}
}

View File

@@ -0,0 +1,110 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePermissionTables extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$tableNames = config('permission.table_names');
$columnNames = config('permission.column_names');
if (empty($tableNames)) {
throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
}
Schema::create($tableNames['permissions'], function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('guard_name');
$table->timestamps();
});
Schema::create($tableNames['roles'], function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('guard_name');
$table->timestamps();
});
Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) {
$table->unsignedBigInteger('permission_id');
$table->string('model_type');
$table->unsignedBigInteger($columnNames['model_morph_key']);
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
$table->foreign('permission_id')
->references('id')
->on($tableNames['permissions'])
->onDelete('cascade');
$table->primary(['permission_id', $columnNames['model_morph_key'], 'model_type'],
'model_has_permissions_permission_model_type_primary');
});
Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) {
$table->unsignedBigInteger('role_id');
$table->string('model_type');
$table->unsignedBigInteger($columnNames['model_morph_key']);
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
$table->foreign('role_id')
->references('id')
->on($tableNames['roles'])
->onDelete('cascade');
$table->primary(['role_id', $columnNames['model_morph_key'], 'model_type'],
'model_has_roles_role_model_type_primary');
});
Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) {
$table->unsignedBigInteger('permission_id');
$table->unsignedBigInteger('role_id');
$table->foreign('permission_id')
->references('id')
->on($tableNames['permissions'])
->onDelete('cascade');
$table->foreign('role_id')
->references('id')
->on($tableNames['roles'])
->onDelete('cascade');
$table->primary(['permission_id', 'role_id'], 'role_has_permissions_permission_id_role_id_primary');
});
app('cache')
->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
->forget(config('permission.cache.key'));
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$tableNames = config('permission.table_names');
if (empty($tableNames)) {
throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
}
Schema::drop($tableNames['role_has_permissions']);
Schema::drop($tableNames['model_has_roles']);
Schema::drop($tableNames['model_has_permissions']);
Schema::drop($tableNames['roles']);
Schema::drop($tableNames['permissions']);
}
}

View File

@@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateBansTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('bans', function (Blueprint $table) {
$table->id();
$table->bigInteger('userID')->unsigned();
$table->string('reason');
$table->timestamp('bannedUntil')->nullable();
$table->string('userAgent');
$table->bigInteger('authorUserID');
$table->timestamps();
$table->foreign('userID')
->references('id')
->on('users');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('bans');
}
}

View File

@@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateCommentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('comments', function (Blueprint $table) {
$table->id();
$table->bigInteger('authorID')->unsigned();
$table->bigInteger('applicationID')->unsigned();
$table->mediumText('text');
$table->timestamps();
$table->foreign('authorID')
->references('id')
->on('users');
$table->foreign('applicationID')
->references('id')
->on('applications');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('comments');
}
}

View File

@@ -0,0 +1,36 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateJobsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('queue')->index();
$table->longText('payload');
$table->unsignedTinyInteger('attempts');
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('jobs');
}
}