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(
'journals',
function (Blueprint $table) {
27 $table->bigInteger(
'journal_id')->autoIncrement();
28 $table->string(
'path', 32);
29 $table->float(
'seq', 8, 2)->
default(0)->comment(
'Used to order lists of journals');
30 $table->string(
'primary_locale', 14);
31 $table->tinyInteger(
'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.)');
32 $table->unique([
'path'],
'journals_path');
36 Capsule::schema()->create(
'journal_settings',
function (Blueprint $table) {
37 $table->bigInteger(
'journal_id');
38 $table->string(
'locale', 14)->
default(
'');
39 $table->string(
'setting_name', 255);
40 $table->text(
'setting_value')->nullable();
41 $table->string(
'setting_type', 6)->nullable();
42 $table->index([
'journal_id'],
'journal_settings_journal_id');
43 $table->unique([
'journal_id',
'locale',
'setting_name'],
'journal_settings_pkey');
47 Capsule::schema()->create(
'sections',
function (Blueprint $table) {
48 $table->bigInteger(
'section_id')->autoIncrement();
49 $table->bigInteger(
'journal_id');
50 $table->bigInteger(
'review_form_id')->nullable();
51 $table->float(
'seq', 8, 2)->
default(0);
52 $table->tinyInteger(
'editor_restricted')->
default(0);
53 $table->tinyInteger(
'meta_indexed')->
default(0);
54 $table->tinyInteger(
'meta_reviewed')->
default(1);
55 $table->tinyInteger(
'abstracts_not_required')->
default(0);
56 $table->tinyInteger(
'hide_title')->
default(0);
57 $table->tinyInteger(
'hide_author')->
default(0);
58 $table->tinyInteger(
'is_inactive')->
default(0);
59 $table->bigInteger(
'abstract_word_count')->nullable();
60 $table->index([
'journal_id'],
'sections_journal_id');
64 Capsule::schema()->create(
'section_settings',
function (Blueprint $table) {
65 $table->bigInteger(
'section_id');
66 $table->string(
'locale', 14)->
default(
'');
67 $table->string(
'setting_name', 255);
68 $table->text(
'setting_value')->nullable();
69 $table->string(
'setting_type', 6)->comment(
'(bool|int|float|string|object)');
70 $table->index([
'section_id'],
'section_settings_section_id');
71 $table->unique([
'section_id',
'locale',
'setting_name'],
'section_settings_pkey');
75 Capsule::schema()->create(
'submission_tombstones',
function (Blueprint $table) {
76 $table->bigInteger(
'tombstone_id')->autoIncrement();
77 $table->bigInteger(
'submission_id');
78 $table->datetime(
'date_deleted');
79 $table->bigInteger(
'journal_id');
80 $table->bigInteger(
'section_id');
81 $table->string(
'set_spec', 255);
82 $table->string(
'set_name', 255);
83 $table->string(
'oai_identifier', 255);
84 $table->index([
'journal_id'],
'submission_tombstones_journal_id');
85 $table->index([
'submission_id'],
'submission_tombstones_submission_id');
89 Capsule::schema()->create(
'publications',
function (Blueprint $table) {
90 $table->bigInteger(
'publication_id')->autoIncrement();
91 $table->bigInteger(
'access_status')->
default(0)->nullable();
92 $table->date(
'date_published')->nullable();
93 $table->datetime(
'last_modified')->nullable();
94 $table->string(
'locale', 14)->nullable();
95 $table->bigInteger(
'primary_contact_id')->nullable();
96 $table->bigInteger(
'section_id')->nullable();
97 $table->bigInteger(
'submission_id');
99 $table->tinyInteger(
'status')->
default(1);
100 $table->string(
'url_path', 64)->nullable();
101 $table->bigInteger(
'version')->nullable();
102 $table->index([
'submission_id'],
'publications_submission_id');
103 $table->index([
'section_id'],
'publications_section_id');
104 $table->index([
'url_path'],
'publications_url_path');
108 Capsule::schema()->create(
'publication_galleys',
function (Blueprint $table) {
109 $table->bigInteger(
'galley_id')->autoIncrement();
110 $table->string(
'locale', 14)->nullable();
111 $table->bigInteger(
'publication_id');
112 $table->string(
'label', 255)->nullable();
113 $table->bigInteger(
'file_id')->nullable();
114 $table->float(
'seq', 8, 2)->
default(0);
115 $table->string(
'remote_url', 2047)->nullable();
116 $table->tinyInteger(
'is_approved')->
default(0);
117 $table->string(
'url_path', 64)->nullable();
118 $table->index([
'publication_id'],
'publication_galleys_publication_id');
119 $table->index([
'url_path'],
'publication_galleys_url_path');
123 Capsule::schema()->create(
'publication_galley_settings',
function (Blueprint $table) {
124 $table->bigInteger(
'galley_id');
125 $table->string(
'locale', 14)->
default(
'');
126 $table->string(
'setting_name', 255);
127 $table->text(
'setting_value')->nullable();
128 $table->index([
'galley_id'],
'publication_galley_settings_galley_id');
129 $table->unique([
'galley_id',
'locale',
'setting_name'],
'publication_galley_settings_pkey');
132 switch (Capsule::connection()->getDriverName()) {
133 case 'mysql': Capsule::connection()->unprepared(
'CREATE INDEX publication_galley_settings_name_value ON publication_galley_settings (setting_name(50), setting_value(150))');
break;
134 case 'pgsql': Capsule::connection()->unprepared(
'CREATE INDEX publication_galley_settings_name_value ON publication_galley_settings (setting_name, setting_value)');
break;
143 Capsule::schema()->drop(
'completed_payments');
144 Capsule::schema()->drop(
'journals');
145 Capsule::schema()->drop(
'journal_settings');
146 Capsule::schema()->drop(
'sections');
147 Capsule::schema()->drop(
'section_settings');
148 Capsule::schema()->drop(
'submission_tombstones');
149 Capsule::schema()->drop(
'publications');
150 Capsule::schema()->drop(
'publication_galleys');
151 Capsule::schema()->drop(
'publication_galley_settings');