aboutsummaryrefslogtreecommitdiff
path: root/database/migrations/2016_01_04_143702_create_verbs_table.php
blob: 257d135e152c4975db5bdd9b207a30ce97197b79 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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', 'c']);
            $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');
    }
}