Open Monograph Press  3.3.0
ReviewsMigration.inc.php
1 <?php
2 
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;
18 
19 class ReviewsMigration extends Migration {
24  public function up() {
25  // Reviewing assignments.
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->smallInteger('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->smallInteger('reminder_was_automatic')->default(0);
41  $table->smallInteger('declined')->default(0);
42  $table->smallInteger('cancelled')->default(0);
43  $table->bigInteger('reviewer_file_id')->nullable();
44  $table->datetime('date_rated')->nullable();
45  $table->datetime('date_reminded')->nullable();
46  $table->smallInteger('quality')->nullable();
47  $table->bigInteger('review_round_id');
48  $table->smallInteger('stage_id');
49 
50  import('lib.pkp.classes.submission.reviewAssignment.ReviewAssignment'); // for constant
51  $table->smallInteger('review_method')->default(SUBMISSION_REVIEW_METHOD_BLIND);
52 
53  $table->smallInteger('round')->default(1);
54  $table->smallInteger('step')->default(1);
55  $table->bigInteger('review_form_id')->nullable();
56  $table->smallInteger('unconsidered')->nullable();
57  $table->index(['submission_id'], 'review_assignments_submission_id');
58  $table->index(['reviewer_id'], 'review_assignments_reviewer_id');
59  $table->index(['review_form_id'], 'review_assignments_form_id');
60  $table->index(['reviewer_id', 'review_id'], 'review_assignments_reviewer_review');
61  });
62 
63  // Review rounds.
64  Capsule::schema()->create('review_rounds', function (Blueprint $table) {
65  $table->bigInteger('review_round_id')->autoIncrement();
66  $table->bigInteger('submission_id');
67  $table->bigInteger('stage_id')->nullable();
68  $table->smallInteger('round');
69  $table->bigInteger('review_revision')->nullable();
70  $table->bigInteger('status')->nullable();
71  $table->index(['submission_id'], 'review_rounds_submission_id');
72  $table->unique(['submission_id', 'stage_id', 'round'], 'review_rounds_submission_id_stage_id_round_pkey');
73  });
74 
75  // Submission Files for each review round
76  Capsule::schema()->create('review_round_files', function (Blueprint $table) {
77  $table->bigInteger('submission_id');
78  $table->bigInteger('review_round_id');
79  $table->smallInteger('stage_id');
80  $table->bigInteger('file_id');
81  $table->bigInteger('revision')->default(1);
82  $table->index(['submission_id'], 'review_round_files_submission_id');
83  $table->unique(['submission_id', 'review_round_id', 'file_id', 'revision'], 'review_round_files_pkey');
84  });
85 
86  // Associates reviewable submission files with reviews
87  Capsule::schema()->create('review_files', function (Blueprint $table) {
88  $table->bigInteger('review_id');
89  $table->bigInteger('file_id');
90  $table->index(['review_id'], 'review_files_review_id');
91  $table->unique(['review_id', 'file_id'], 'review_files_pkey');
92  });
93  }
94 
99  public function down() {
100  Capsule::schema()->drop('review_files');
101  Capsule::schema()->drop('review_round_files');
102  Capsule::schema()->drop('review_rounds');
103  Capsule::schema()->drop('review_assignments');
104  }
105 }
ReviewsMigration\up
up()
Definition: ReviewsMigration.inc.php:24
ReviewsMigration
Describe database table structures.
Definition: ReviewsMigration.inc.php:19
ReviewsMigration\down
down()
Definition: ReviewsMigration.inc.php:99