diff options
| author | Camil Staps | 2016-09-05 22:30:47 +0200 | 
|---|---|---|
| committer | Camil Staps | 2016-09-05 22:30:47 +0200 | 
| commit | fc5cef0efddbb1141b0a371108a23fc7f6e8d860 (patch) | |
| tree | 8b3e62b50e5f856c57af477a78a51567d6e859f2 /database | |
| parent | User creation and authentication (diff) | |
Vote on verb suggestions
Diffstat (limited to 'database')
| -rw-r--r-- | database/migrations/2016_09_04_081754_create_verb_actions_table.php | 38 | ||||
| -rw-r--r-- | database/migrations/2016_09_04_081924_add_active_to_verbs.php | 31 | 
2 files changed, 69 insertions, 0 deletions
| diff --git a/database/migrations/2016_09_04_081754_create_verb_actions_table.php b/database/migrations/2016_09_04_081754_create_verb_actions_table.php new file mode 100644 index 0000000..d7b0f29 --- /dev/null +++ b/database/migrations/2016_09_04_081754_create_verb_actions_table.php @@ -0,0 +1,38 @@ +<?php + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class CreateVerbActionsTable extends Migration +{ +	/** +	 * Run the migrations. +	 * +	 * @return void +	 */ +	public function up() +	{ +		Schema::create('verb_actions', function (Blueprint $table) { +			$table->increments('id'); +			$table->integer('user_id')->unsigned(); +			$table->integer('verb_id')->unsigned(); +			$table->tinyInteger('kind'); +			$table->tinyInteger('vote_weight')->nullable(); +			$table->string('comment_text')->nullable(); +			$table->timestamp('date')->default(DB::raw('CURRENT_TIMESTAMP')); + +			$table->foreign('user_id')->references('id')->on('users'); +			$table->foreign('verb_id')->references('id')->on('verbs'); +		}); +	} + +	/** +	 * Reverse the migrations. +	 * +	 * @return void +	 */ +	public function down() +	{ +		Schema::drop('verb_actions'); +	} +} diff --git a/database/migrations/2016_09_04_081924_add_active_to_verbs.php b/database/migrations/2016_09_04_081924_add_active_to_verbs.php new file mode 100644 index 0000000..79c5993 --- /dev/null +++ b/database/migrations/2016_09_04_081924_add_active_to_verbs.php @@ -0,0 +1,31 @@ +<?php + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class AddActiveToVerbs extends Migration +{ +	/** +	 * Run the migrations. +	 * +	 * @return void +	 */ +	public function up() +	{ +		Schema::table('verbs', function (Blueprint $table) { +			$table->boolean('active')->default(true); +		}); +	} + +	/** +	 * Reverse the migrations. +	 * +	 * @return void +	 */ +	public function down() +	{ +		Schema::table('verbs', function (Blueprint $table) { +			$table->dropColumn('active'); +		}); +	} +} | 
