Open Journal Systems  3.3.0
ControlledVocabMigration.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 ControlledVocabMigration extends Migration {
24  public function up() {
25  // Controlled vocabularies
26  Capsule::schema()->create('controlled_vocabs', function (Blueprint $table) {
27  $table->bigInteger('controlled_vocab_id')->autoIncrement();
28  $table->string('symbolic', 64);
29  $table->bigInteger('assoc_type')->default(0);
30  $table->bigInteger('assoc_id')->default(0);
31  $table->unique(['symbolic', 'assoc_type', 'assoc_id'], 'controlled_vocab_symbolic');
32  });
33 
34  // Controlled vocabulary entries
35  Capsule::schema()->create('controlled_vocab_entries', function (Blueprint $table) {
36  $table->bigInteger('controlled_vocab_entry_id')->autoIncrement();
37  $table->bigInteger('controlled_vocab_id');
38  $table->float('seq', 8, 2)->nullable();
39  $table->index(['controlled_vocab_id', 'seq'], 'controlled_vocab_entries_cv_id');
40  });
41 
42  // Controlled vocabulary entry settings
43  Capsule::schema()->create('controlled_vocab_entry_settings', function (Blueprint $table) {
44  $table->bigInteger('controlled_vocab_entry_id');
45  $table->string('locale', 14)->default('');
46  $table->string('setting_name', 255);
47  $table->text('setting_value')->nullable();
48  $table->string('setting_type', 6);
49  $table->index(['controlled_vocab_entry_id'], 'c_v_e_s_entry_id');
50  $table->unique(['controlled_vocab_entry_id', 'locale', 'setting_name'], 'c_v_e_s_pkey');
51  });
52 
53  // Reviewer Interests Associative Table
54  Capsule::schema()->create('user_interests', function (Blueprint $table) {
55  $table->bigInteger('user_id');
56  $table->bigInteger('controlled_vocab_entry_id');
57  $table->unique(['user_id', 'controlled_vocab_entry_id'], 'u_e_pkey');
58  });
59 
60  }
61 
66  public function down() {
67  Capsule::schema()->drop('user_interests');
68  Capsule::schema()->drop('controlled_vocab_entry_settings');
69  Capsule::schema()->drop('controlled_vocab_entries');
70  Capsule::schema()->drop('controlled_vocabs');
71  }
72 }
ControlledVocabMigration\down
down()
Definition: ControlledVocabMigration.inc.php:66
ControlledVocabMigration\up
up()
Definition: ControlledVocabMigration.inc.php:24
ControlledVocabMigration
Describe database table structures.
Definition: ControlledVocabMigration.inc.php:19