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(
'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');
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');
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');
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');
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');