Open Monograph Press  3.3.0
GenresMigration.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 GenresMigration extends Migration {
24  public function up() {
25  // A context's submission file genres.
26  Capsule::schema()->create('genres', function (Blueprint $table) {
27  $table->bigInteger('genre_id')->autoIncrement();
28  $table->bigInteger('context_id');
29  $table->bigInteger('seq');
30  $table->smallInteger('enabled')->default(1);
31 
32  import('lib.pkp.classes.submission.Genre'); // for constant
33  $table->bigInteger('category')->default(GENRE_CATEGORY_DOCUMENT);
34 
35  $table->smallInteger('dependent')->default(0);
36  $table->smallInteger('supplementary')->default(0);
37  $table->string('entry_key', 30)->nullable();
38  });
39 
40  // Genre settings
41  Capsule::schema()->create('genre_settings', function (Blueprint $table) {
42  $table->bigInteger('genre_id');
43  $table->string('locale', 14)->default('');
44  $table->string('setting_name', 255);
45  $table->text('setting_value')->nullable();
46  $table->string('setting_type', 6)->comment('(bool|int|float|string|object)');
47  $table->index(['genre_id'], 'genre_settings_genre_id');
48  $table->unique(['genre_id', 'locale', 'setting_name'], 'genre_settings_pkey');
49  });
50 
51  }
52 
57  public function down() {
58  Capsule::schema()->drop('genre_settings');
59  Capsule::schema()->drop('genres');
60  }
61 }
GenresMigration
Describe database table structures.
Definition: GenresMigration.inc.php:19
GenresMigration\down
down()
Definition: GenresMigration.inc.php:57
GenresMigration\up
up()
Definition: GenresMigration.inc.php:24