14 use Illuminate\Database\Migrations\Migration;
15 use Illuminate\Database\Schema\Builder;
16 use Illuminate\Database\Schema\Blueprint;
17 use Illuminate\Database\Capsule\Manager as Capsule;
24 public function up() {
26 Capsule::schema()->create(
'user_groups',
function (Blueprint $table) {
27 $table->bigInteger(
'user_group_id')->autoIncrement();
28 $table->bigInteger(
'context_id');
29 $table->bigInteger(
'role_id');
30 $table->smallInteger(
'is_default')->
default(0);
31 $table->smallInteger(
'show_title')->
default(1);
32 $table->smallInteger(
'permit_self_registration')->
default(0);
33 $table->smallInteger(
'permit_metadata_edit')->
default(0);
34 $table->index([
'user_group_id'],
'user_groups_user_group_id');
35 $table->index([
'context_id'],
'user_groups_context_id');
36 $table->index([
'role_id'],
'user_groups_role_id');
40 Capsule::schema()->create(
'user_group_settings',
function (Blueprint $table) {
41 $table->bigInteger(
'user_group_id');
42 $table->string(
'locale', 14)->
default(
'');
43 $table->string(
'setting_name', 255);
44 $table->text(
'setting_value')->nullable();
45 $table->string(
'setting_type', 6)->comment(
'(bool|int|float|string|object)');
46 $table->unique([
'user_group_id',
'locale',
'setting_name'],
'user_group_settings_pkey');
50 Capsule::schema()->create(
'user_user_groups',
function (Blueprint $table) {
51 $table->bigInteger(
'user_group_id');
52 $table->bigInteger(
'user_id');
53 $table->index([
'user_group_id'],
'user_user_groups_user_group_id');
54 $table->index([
'user_id'],
'user_user_groups_user_id');
55 $table->unique([
'user_group_id',
'user_id'],
'user_user_groups_pkey');
59 Capsule::schema()->create(
'user_group_stage',
function (Blueprint $table) {
60 $table->bigInteger(
'context_id');
61 $table->bigInteger(
'user_group_id');
62 $table->bigInteger(
'stage_id');
63 $table->index([
'context_id'],
'user_group_stage_context_id');
64 $table->index([
'user_group_id'],
'user_group_stage_user_group_id');
65 $table->index([
'stage_id'],
'user_group_stage_stage_id');
66 $table->unique([
'context_id',
'user_group_id',
'stage_id'],
'user_group_stage_pkey');
70 Capsule::schema()->create(
'stage_assignments',
function (Blueprint $table) {
71 $table->bigInteger(
'stage_assignment_id')->autoIncrement();
72 $table->bigInteger(
'submission_id');
73 $table->bigInteger(
'user_group_id');
74 $table->bigInteger(
'user_id');
75 $table->datetime(
'date_assigned');
76 $table->smallInteger(
'recommend_only')->
default(0);
77 $table->smallInteger(
'can_change_metadata')->
default(0);
78 $table->unique([
'submission_id',
'user_group_id',
'user_id'],
'stage_assignment');
79 $table->index([
'submission_id'],
'stage_assignments_submission_id');
80 $table->index([
'user_group_id'],
'stage_assignments_user_group_id');
81 $table->index([
'user_id'],
'stage_assignments_user_id');
90 Capsule::schema()->drop(
'stage_assignments');
91 Capsule::schema()->drop(
'user_group_stage');
92 Capsule::schema()->drop(
'user_user_groups');
93 Capsule::schema()->drop(
'user_group_settings');
94 Capsule::schema()->drop(
'user_groups');