diff options
| author | Camil Staps | 2016-01-04 16:00:32 +0100 | 
|---|---|---|
| committer | Camil Staps | 2016-01-04 16:00:32 +0100 | 
| commit | eda622cb3b37c401f74be60b21d3a9a3fb34c440 (patch) | |
| tree | 9a15d037dfd3438004f34883d50c177c7b190976 /database/migrations | |
| parent | Initial commit (diff) | |
Migrations: stems, tenses, roots, verbs, translations
Diffstat (limited to 'database/migrations')
5 files changed, 174 insertions, 0 deletions
| diff --git a/database/migrations/2016_01_04_143639_create_stems_table.php b/database/migrations/2016_01_04_143639_create_stems_table.php new file mode 100644 index 0000000..1a2cbe0 --- /dev/null +++ b/database/migrations/2016_01_04_143639_create_stems_table.php @@ -0,0 +1,31 @@ +<?php + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class CreateStemsTable extends Migration +{ +    /** +     * Run the migrations. +     * +     * @return void +     */ +    public function up() +    { +        Schema::create('stems', function (Blueprint $table) { +            $table->increments('id'); +            $table->string('name', 24)->unique(); +            $table->timestamps(); +        }); +    } + +    /** +     * Reverse the migrations. +     * +     * @return void +     */ +    public function down() +    { +        Schema::drop('stems'); +    } +} diff --git a/database/migrations/2016_01_04_143647_create_tenses_table.php b/database/migrations/2016_01_04_143647_create_tenses_table.php new file mode 100644 index 0000000..e4ed023 --- /dev/null +++ b/database/migrations/2016_01_04_143647_create_tenses_table.php @@ -0,0 +1,32 @@ +<?php + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class CreateTensesTable extends Migration +{ +    /** +     * Run the migrations. +     * +     * @return void +     */ +    public function up() +    { +        Schema::create('tenses', function (Blueprint $table) { +            $table->increments('id'); +            $table->string('name', 24)->unique(); +            $table->string('abbreviation', 6)->unique(); +            $table->timestamps(); +        }); +    } + +    /** +     * Reverse the migrations. +     * +     * @return void +     */ +    public function down() +    { +        Schema::drop('tenses'); +    } +} diff --git a/database/migrations/2016_01_04_143655_create_roots_table.php b/database/migrations/2016_01_04_143655_create_roots_table.php new file mode 100644 index 0000000..1828bfd --- /dev/null +++ b/database/migrations/2016_01_04_143655_create_roots_table.php @@ -0,0 +1,32 @@ +<?php + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class CreateRootsTable extends Migration +{ +    /** +     * Run the migrations. +     * +     * @return void +     */ +    public function up() +    { +        Schema::create('roots', function (Blueprint $table) { +            $table->increments('id'); +            $table->string('root', 24)->collate('utf8_general_ci')->unique(); +            $table->boolean('strong'); +            $table->timestamps(); +        }); +    } + +    /** +     * Reverse the migrations. +     * +     * @return void +     */ +    public function down() +    { +        Schema::drop('roots'); +    } +} diff --git a/database/migrations/2016_01_04_143702_create_verbs_table.php b/database/migrations/2016_01_04_143702_create_verbs_table.php new file mode 100644 index 0000000..6449020 --- /dev/null +++ b/database/migrations/2016_01_04_143702_create_verbs_table.php @@ -0,0 +1,43 @@ +<?php + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class CreateVerbsTable extends Migration +{ +    /** +     * Run the migrations. +     * +     * @return void +     */ +    public function up() +    { +        Schema::create('verbs', function (Blueprint $table) { +            $table->increments('id'); +            $table->string('verb', 24)->collate('utf8_general_ci'); +            $table->string('root', 24)->collate('utf8_general_ci'); +            $table->string('stem', 24); +            $table->string('tense', 24); +            $table->enum('person', [1,2,3])->nullable(); +            $table->enum('gender', ['m', 'f']); +            $table->enum('number', ['s', 'p']); +            $table->timestamps(); + +            $table->unique(['verb', 'root', 'stem', 'tense', 'gender', 'number']); + +            $table->foreign('root')->references('root')->on('roots'); +            $table->foreign('stem')->references('name')->on('stems'); +            $table->foreign('tense')->references('name')->on('tenses'); +        }); +    } + +    /** +     * Reverse the migrations. +     * +     * @return void +     */ +    public function down() +    { +        Schema::drop('verbs'); +    } +} diff --git a/database/migrations/2016_01_04_144049_create_root_translations_table.php b/database/migrations/2016_01_04_144049_create_root_translations_table.php new file mode 100644 index 0000000..160fe32 --- /dev/null +++ b/database/migrations/2016_01_04_144049_create_root_translations_table.php @@ -0,0 +1,36 @@ +<?php + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class CreateRootTranslationsTable extends Migration +{ +    /** +     * Run the migrations. +     * +     * @return void +     */ +    public function up() +    { +        Schema::create('root_translations', function (Blueprint $table) { +            $table->increments('id'); +            $table->string('root', 24)->collate('utf8_general_ci'); +            $table->string('translation', 63); +            $table->timestamps(); + +            $table->unique(['root', 'translation']); + +            $table->foreign('root')->references('root')->on('roots'); +        }); +    } + +    /** +     * Reverse the migrations. +     * +     * @return void +     */ +    public function down() +    { +        Schema::drop('root_translations'); +    } +} | 
