Open Journal Systems  3.3.0
tmp.php
1 <?php
2 
3 use Illuminate\Database\Migrations\Migration;
4 use Illuminate\Database\Schema\Builder;
5 use Illuminate\Database\Schema\Blueprint;
6 use Illuminate\Database\Capsule\Manager as Capsule;
7 
8 class CommonSchema extends Migration {
13  public function up() {
14  // Journals and basic journal settings.
15  Capsule::schema()->create('journals', function (Blueprint $table) {
16  $table->bigInteger('journal_id')->autoIncrement();
17  $table->string('path', 32);
18  $table->float('seq', 8, 2)->default('0')->comment('Used to order lists of journals');
19  $table->string('primary_locale', 14);
20  $table->boolean('enabled')->default('1')->comment('Controls whether or not the journal is considered "live" and will appear on the website. (Note that disabled journals may still be accessible, but only if the user knows the URL.)');
21  });
22 
23  // Journal settings.
24  Capsule::schema()->create('journal_settings', function (Blueprint $table) {
25  $table->bigInteger('journal_id');
26  $table->string('locale', 14)->default('');
27  $table->string('setting_name', 255);
28  $table->text('setting_value')->nullable();
29  $table->string('setting_type', 6)->nullable();
30  });
31 
32  // Journal sections.
33  Capsule::schema()->create('sections', function (Blueprint $table) {
34  $table->bigInteger('section_id')->autoIncrement();
35  $table->bigInteger('journal_id');
36  $table->bigInteger('review_form_id')->nullable();
37  $table->float('seq', 8, 2)->default('0');
38  $table->boolean('editor_restricted')->default('0');
39  $table->boolean('meta_indexed')->default('0');
40  $table->boolean('meta_reviewed')->default('1');
41  $table->boolean('abstracts_not_required')->default('0');
42  $table->boolean('hide_title')->default('0');
43  $table->boolean('hide_author')->default('0');
44  $table->bigInteger('abstract_word_count')->nullable();
45  });
46 
47  // Section-specific settings
48  Capsule::schema()->create('section_settings', function (Blueprint $table) {
49  $table->bigInteger('section_id');
50  $table->string('locale', 14)->default('');
51  $table->string('setting_name', 255);
52  $table->text('setting_value')->nullable();
53  $table->string('setting_type', 6)->comment('(bool|int|float|string|object)');
54  });
55 
56  // Journal issues.
57  Capsule::schema()->create('issues', function (Blueprint $table) {
58  $table->bigInteger('issue_id')->autoIncrement();
59  $table->bigInteger('journal_id');
60  $table->smallInteger('volume')->nullable();
61  $table->string('number', 40)->nullable();
62  $table->smallInteger('year')->nullable();
63  $table->boolean('published')->default('0');
64  $table->boolean('current')->default('0');
65  $table->timestamp('date_published')->nullable();
66  $table->timestamp('date_notified')->nullable();
67  $table->timestamp('last_modified')->nullable();
68  $table->boolean('access_status')->default('1');
69  $table->timestamp('open_access_date')->nullable();
70  $table->boolean('show_volume')->default('0');
71  $table->boolean('show_number')->default('0');
72  $table->boolean('show_year')->default('0');
73  $table->boolean('show_title')->default('0');
74  $table->string('style_file_name', 90)->nullable();
75  $table->string('original_style_file_name', 255)->nullable();
76  $table->string('url_path', 64)->nullable();
77  });
78 
79  // Locale-specific issue data
80  Capsule::schema()->create('issue_settings', function (Blueprint $table) {
81  $table->bigInteger('issue_id');
82  $table->string('locale', 14)->default('');
83  $table->string('setting_name', 255);
84  $table->text('setting_value')->nullable();
85  $table->string('setting_type', 6);
86  });
87 
88  // Issue galleys.
89  Capsule::schema()->create('issue_galleys', function (Blueprint $table) {
90  $table->bigInteger('galley_id')->autoIncrement();
91  $table->string('locale', 14)->nullable();
92  $table->bigInteger('issue_id');
93  $table->bigInteger('file_id');
94  $table->string('label', 32)->nullable();
95  $table->float('seq', 8, 2)->default('0');
96  $table->string('url_path', 64)->nullable();
97  });
98 
99  // Issue galley metadata.
100  Capsule::schema()->create('issue_galley_settings', function (Blueprint $table) {
101  $table->bigInteger('galley_id');
102  $table->string('locale', 14)->default('');
103  $table->string('setting_name', 255);
104  $table->text('setting_value')->nullable();
105  $table->string('setting_type', 6)->comment('(bool|int|float|string|object)');
106  });
107 
108  Capsule::schema()->create('issue_files', function (Blueprint $table) {
109  $table->bigInteger('file_id')->autoIncrement();
110  $table->bigInteger('issue_id');
111  $table->string('file_name', 90);
112  $table->string('file_type', 255);
113  $table->bigInteger('file_size');
114  $table->bigInteger('content_type');
115  $table->string('original_file_name', 127)->nullable();
116  $table->timestamp('date_uploaded');
117  $table->timestamp('date_modified');
118  });
119 
120  // Custom sequencing information for journal issues, when available
121  Capsule::schema()->create('custom_issue_orders', function (Blueprint $table) {
122  $table->bigInteger('issue_id');
123  $table->bigInteger('journal_id');
124  $table->float('seq', 8, 2)->default('0');
125  });
126 
127  // Custom sequencing information for journal sections by issue, when available.
128  Capsule::schema()->create('custom_section_orders', function (Blueprint $table) {
129  $table->bigInteger('issue_id');
130  $table->bigInteger('section_id');
131  $table->float('seq', 8, 2)->default('0');
132  });
133 
134  // Archived, removed from TOC, unscheduled or unpublished journal articles.
135  Capsule::schema()->create('submission_tombstones', function (Blueprint $table) {
136  $table->bigInteger('tombstone_id')->autoIncrement();
137  $table->bigInteger('submission_id');
138  $table->timestamp('date_deleted');
139  $table->bigInteger('journal_id');
140  $table->bigInteger('section_id');
141  $table->string('set_spec', 255);
142  $table->string('set_name', 255);
143  $table->string('oai_identifier', 255);
144  });
145 
146  // Publications
147  Capsule::schema()->create('publications', function (Blueprint $table) {
148  $table->bigInteger('publication_id')->autoIncrement();
149  $table->bigInteger('access_status')->default('0')->nullable();
150  $table->date('date_published')->nullable();
151  $table->timestamp('last_modified')->nullable();
152  $table->string('locale', 14)->nullable();
153  $table->bigInteger('primary_contact_id')->nullable();
154  $table->bigInteger('section_id')->nullable();
155  $table->float('seq', 8, 2)->default('0');
156  $table->bigInteger('submission_id');
157  $table->boolean('status')->default('1');
158  $table->string('url_path', 64)->nullable();
159  $table->bigInteger('version')->nullable();
160  });
161 
162  // Publication galleys
163  Capsule::schema()->create('publication_galleys', function (Blueprint $table) {
164  $table->bigInteger('galley_id')->autoIncrement();
165  $table->string('locale', 14)->nullable();
166  $table->bigInteger('publication_id');
167  $table->string('label', 255)->nullable();
168  $table->bigInteger('file_id')->nullable();
169  $table->float('seq', 8, 2)->default('0');
170  $table->string('remote_url', 2047)->nullable();
171  $table->boolean('is_approved')->default('0');
172  $table->string('url_path', 64)->nullable();
173  });
174 
175  // Galley metadata.
176  Capsule::schema()->create('publication_galley_settings', function (Blueprint $table) {
177  $table->bigInteger('galley_id');
178  $table->string('locale', 14)->default('');
179  $table->string('setting_name', 255);
180  $table->text('setting_value')->nullable();
181  });
182 
183  // Subscription types.
184  Capsule::schema()->create('subscription_types', function (Blueprint $table) {
185  $table->bigInteger('type_id')->autoIncrement();
186  $table->bigInteger('journal_id');
187  $table->float('cost', 8, 2);
188  $table->string('currency_code_alpha', 3);
189  $table->boolean('non_expiring')->default('0');
190  $table->smallInteger('duration')->nullable();
191  $table->smallInteger('format');
192  $table->boolean('institutional')->default('0');
193  $table->boolean('membership')->default('0');
194  $table->boolean('disable_public_display');
195  $table->float('seq', 8, 2);
196  });
197 
198  // Locale-specific subscription type data
199  Capsule::schema()->create('subscription_type_settings', function (Blueprint $table) {
200  $table->bigInteger('type_id');
201  $table->string('locale', 14)->default('');
202  $table->string('setting_name', 255);
203  $table->text('setting_value')->nullable();
204  $table->string('setting_type', 6);
205  });
206 
207  // Journal subscriptions.
208  Capsule::schema()->create('subscriptions', function (Blueprint $table) {
209  $table->bigInteger('subscription_id')->autoIncrement();
210  $table->bigInteger('journal_id');
211  $table->bigInteger('user_id');
212  $table->bigInteger('type_id');
213  $table->date('date_start')->nullable();
214  $table->timestamp('date_end')->nullable();
215  $table->boolean('status')->default('1');
216  $table->string('membership', 40)->nullable();
217  $table->string('reference_number', 40)->nullable();
218  $table->text('notes')->nullable();
219  });
220 
221  // Journal institutional subscriptions.
222  Capsule::schema()->create('institutional_subscriptions', function (Blueprint $table) {
223  $table->bigInteger('institutional_subscription_id')->autoIncrement();
224  $table->bigInteger('subscription_id');
225  $table->string('institution_name', 255);
226  $table->string('mailing_address', 255)->nullable();
227  $table->string('domain', 255)->nullable();
228  });
229 
230  // Journal institutional subscription IPs and IP ranges.
231  Capsule::schema()->create('institutional_subscription_ip', function (Blueprint $table) {
232  $table->bigInteger('institutional_subscription_ip_id')->autoIncrement();
233  $table->bigInteger('subscription_id');
234  $table->string('ip_string', 40);
235  $table->bigInteger('ip_start');
236  $table->bigInteger('ip_end')->nullable();
237  });
238 
239  // Logs queued (unfulfilled) payments.
240  Capsule::schema()->create('queued_payments', function (Blueprint $table) {
241  $table->bigInteger('queued_payment_id')->autoIncrement();
242  $table->timestamp('date_created');
243  $table->timestamp('date_modified');
244  $table->date('expiry_date')->nullable();
245  $table->text('payment_data')->nullable();
246  });
247 
248  // Logs completed (fulfilled) payments.
249  Capsule::schema()->create('completed_payments', function (Blueprint $table) {
250  $table->bigInteger('completed_payment_id')->autoIncrement();
251  $table->timestamp('timestamp');
252  $table->bigInteger('payment_type');
253  $table->bigInteger('context_id');
254  $table->bigInteger('user_id')->nullable();
255  $table->bigInteger('assoc_id')->nullable();
256  $table->float('amount', 8, 2);
257  $table->string('currency_code_alpha', 3)->nullable();
258  $table->string('payment_method_plugin_name', 80)->nullable();
259  });
260 
261  }
262 }
CommonSchema
Definition: tmp.php:8
CommonSchema\up
up()
Definition: tmp.php:13