Open Monograph Press  3.3.0
ReviewFormsMigration.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 ReviewFormsMigration extends Migration {
24  public function up() {
25  // Review forms.
26  Capsule::schema()->create('review_forms', function (Blueprint $table) {
27  $table->bigInteger('review_form_id')->autoIncrement();
28  $table->bigInteger('assoc_type');
29  $table->bigInteger('assoc_id');
30  $table->float('seq', 8, 2)->nullable();
31  $table->smallInteger('is_active')->nullable();
32  });
33 
34  // Review form settings
35  Capsule::schema()->create('review_form_settings', function (Blueprint $table) {
36  $table->bigInteger('review_form_id');
37  $table->string('locale', 14)->default('');
38  $table->string('setting_name', 255);
39  $table->text('setting_value')->nullable();
40  $table->string('setting_type', 6);
41  $table->index(['review_form_id'], 'review_form_settings_review_form_id');
42  $table->unique(['review_form_id', 'locale', 'setting_name'], 'review_form_settings_pkey');
43  });
44 
45  // Review form elements.
46  Capsule::schema()->create('review_form_elements', function (Blueprint $table) {
47  $table->bigInteger('review_form_element_id')->autoIncrement();
48  $table->bigInteger('review_form_id');
49  $table->float('seq', 8, 2)->nullable();
50  $table->bigInteger('element_type')->nullable();
51  $table->smallInteger('required')->nullable();
52  $table->smallInteger('included')->nullable();
53  $table->index(['review_form_id'], 'review_form_elements_review_form_id');
54  });
55 
56  // Review form element settings
57  Capsule::schema()->create('review_form_element_settings', function (Blueprint $table) {
58  $table->bigInteger('review_form_element_id');
59  $table->string('locale', 14)->default('');
60  $table->string('setting_name', 255);
61  $table->text('setting_value')->nullable();
62  $table->string('setting_type', 6);
63  $table->index(['review_form_element_id'], 'review_form_element_settings_review_form_element_id');
64  $table->unique(['review_form_element_id', 'locale', 'setting_name'], 'review_form_element_settings_pkey');
65  });
66 
67  // Review form responses.
68  Capsule::schema()->create('review_form_responses', function (Blueprint $table) {
69  $table->bigInteger('review_form_element_id');
70  $table->bigInteger('review_id');
71  $table->string('response_type', 6)->nullable();
72  $table->text('response_value')->nullable();
73  $table->index(['review_form_element_id', 'review_id'], 'review_form_responses_pkey');
74  });
75  }
76 
81  public function down() {
82  Capsule::schema()->drop('review_form_responses');
83  Capsule::schema()->drop('review_form_element_settings');
84  Capsule::schema()->drop('review_form_elements');
85  Capsule::schema()->drop('review_form_settings');
86  Capsule::schema()->drop('review_forms');
87  }
88 }
ReviewFormsMigration\down
down()
Definition: ReviewFormsMigration.inc.php:81
ReviewFormsMigration
Describe database table structures.
Definition: ReviewFormsMigration.inc.php:19
ReviewFormsMigration\up
up()
Definition: ReviewFormsMigration.inc.php:24