Open Preprint Systems  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->tinyInteger('enabled')->default(1);
31  $table->bigInteger('category')->default(1);
32  $table->tinyInteger('dependent')->default(0);
33  $table->tinyInteger('supplementary')->default(0);
34  $table->string('entry_key', 30)->nullable();
35  });
36 
37  // Genre settings
38  Capsule::schema()->create('genre_settings', function (Blueprint $table) {
39  $table->bigInteger('genre_id');
40  $table->string('locale', 14)->default('');
41  $table->string('setting_name', 255);
42  $table->text('setting_value')->nullable();
43  $table->string('setting_type', 6)->comment('(bool|int|float|string|object)');
44  $table->index(['genre_id'], 'genre_settings_genre_id');
45  $table->unique(['genre_id', 'locale', 'setting_name'], 'genre_settings_pkey');
46  });
47 
48  }
49 
54  public function down() {
55  Capsule::schema()->drop('genre_settings');
56  Capsule::schema()->drop('genres');
57  }
58 }
GenresMigration
Describe database table structures.
Definition: GenresMigration.inc.php:19
GenresMigration\down
down()
Definition: GenresMigration.inc.php:54
GenresMigration\up
up()
Definition: GenresMigration.inc.php:24