Attendize/database/migrations/2014_11_07_132018_add_affil...

40 lines
1.0 KiB
PHP
Raw Normal View History

2016-02-29 15:59:36 +00:00
<?php
use Illuminate\Database\Migrations\Migration;
2016-03-05 00:18:10 +00:00
class AddAffiliatesTable extends Migration
{
2016-02-29 15:59:36 +00:00
/**
* Run the migrations.
*
* @return void
*/
2016-03-05 00:18:10 +00:00
public function up()
{
Schema::create('affiliates', function ($table) {
2016-02-29 15:59:36 +00:00
$table->increments('id');
$table->string('name', 125);
$table->integer('visits');
$table->integer('tickets_sold');
$table->decimal('sales_volume', 10, 2)->default(0);
2016-02-29 15:59:36 +00:00
$table->timestamp('last_visit');
$table->unsignedInteger('account_id')->index();
$table->unsignedInteger('event_id');
$table->nullableTimestamps();
2016-02-29 15:59:36 +00:00
$table->foreign('account_id')->references('id')->on('accounts')->onDelete('cascade');
$table->foreign('event_id')->references('id')->on('events')->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
2016-03-05 00:18:10 +00:00
public function down()
{
Schema::drop('affiliates');
2016-02-29 15:59:36 +00:00
}
}