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(
'review_assignments',
function (Blueprint $table) {
27 $table->bigInteger(
'review_id')->autoIncrement();
28 $table->bigInteger(
'submission_id');
29 $table->bigInteger(
'reviewer_id');
30 $table->text(
'competing_interests')->nullable();
31 $table->tinyInteger(
'recommendation')->nullable();
32 $table->datetime(
'date_assigned')->nullable();
33 $table->datetime(
'date_notified')->nullable();
34 $table->datetime(
'date_confirmed')->nullable();
35 $table->datetime(
'date_completed')->nullable();
36 $table->datetime(
'date_acknowledged')->nullable();
37 $table->datetime(
'date_due')->nullable();
38 $table->datetime(
'date_response_due')->nullable();
39 $table->datetime(
'last_modified')->nullable();
40 $table->tinyInteger(
'reminder_was_automatic')->
default(0);
41 $table->tinyInteger(
'declined')->
default(0);
42 $table->tinyInteger(
'cancelled')->
default(0);
43 $table->bigInteger(
'reviewer_file_id')->nullable();
44 $table->datetime(
'date_rated')->nullable();
45 $table->datetime(
'date_reminded')->nullable();
46 $table->tinyInteger(
'quality')->nullable();
47 $table->bigInteger(
'review_round_id');
48 $table->tinyInteger(
'stage_id')->
default(1);
49 $table->tinyInteger(
'review_method')->
default(1);
50 $table->tinyInteger(
'round')->
default(1);
51 $table->tinyInteger(
'step')->
default(1);
52 $table->bigInteger(
'review_form_id')->nullable();
53 $table->tinyInteger(
'unconsidered')->nullable();
54 $table->index([
'submission_id'],
'review_assignments_submission_id');
55 $table->index([
'reviewer_id'],
'review_assignments_reviewer_id');
56 $table->index([
'review_form_id'],
'review_assignments_form_id');
57 $table->index([
'reviewer_id',
'review_id'],
'review_assignments_reviewer_review');
61 Capsule::schema()->create(
'review_rounds',
function (Blueprint $table) {
62 $table->bigInteger(
'review_round_id')->autoIncrement();
63 $table->bigInteger(
'submission_id');
64 $table->bigInteger(
'stage_id')->nullable();
65 $table->tinyInteger(
'round');
66 $table->bigInteger(
'review_revision')->nullable();
67 $table->bigInteger(
'status')->nullable();
68 $table->index([
'submission_id'],
'review_rounds_submission_id');
69 $table->unique([
'submission_id',
'stage_id',
'round'],
'review_rounds_submission_id_stage_id_round_pkey');
73 Capsule::schema()->create(
'review_round_files',
function (Blueprint $table) {
74 $table->bigInteger(
'submission_id');
75 $table->bigInteger(
'review_round_id');
76 $table->tinyInteger(
'stage_id');
77 $table->bigInteger(
'file_id');
78 $table->bigInteger(
'revision')->
default(1);
79 $table->index([
'submission_id'],
'review_round_files_submission_id');
80 $table->unique([
'submission_id',
'review_round_id',
'file_id',
'revision'],
'review_round_files_pkey');
84 Capsule::schema()->create(
'review_files',
function (Blueprint $table) {
85 $table->bigInteger(
'review_id');
86 $table->bigInteger(
'file_id');
87 $table->index([
'review_id'],
'review_files_review_id');
88 $table->unique([
'review_id',
'file_id'],
'review_files_pkey');
97 Capsule::schema()->drop(
'review_files');
98 Capsule::schema()->drop(
'review_round_files');
99 Capsule::schema()->drop(
'review_rounds');
100 Capsule::schema()->drop(
'review_assignments');