]> BookStack Code Mirror - bookstack/blob - database/migrations/2016_05_06_185215_create_attributes_table.php
Started base work on attribute system
[bookstack] / database / migrations / 2016_05_06_185215_create_attributes_table.php
1 <?php
2
3 use Illuminate\Database\Schema\Blueprint;
4 use Illuminate\Database\Migrations\Migration;
5
6 class CreateAttributesTable extends Migration
7 {
8     /**
9      * Run the migrations.
10      *
11      * @return void
12      */
13     public function up()
14     {
15         Schema::create('attributes', function (Blueprint $table) {
16             $table->increments('id');
17             $table->integer('entity_id');
18             $table->string('entity_type', 100);
19             $table->string('name');
20             $table->string('value');
21             $table->timestamps();
22
23             $table->index('name');
24             $table->index('value');
25             $table->index(['entity_id', 'entity_type']);
26         });
27     }
28
29     /**
30      * Reverse the migrations.
31      *
32      * @return void
33      */
34     public function down()
35     {
36         Schema::drop('attributes');
37     }
38 }