Added early_access field

This commit is contained in:
Hillel Coren 2016-01-07 13:09:21 +02:00
parent 4549643fdc
commit ecaf31ec95
3 changed files with 64 additions and 72 deletions

View File

@ -1,10 +1,9 @@
<?php <?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Migrations\Migration;
class AddInvoiceFontSupport extends Migration { class AddInvoiceFontSupport extends Migration
{
/** /**
* Run the migrations. * Run the migrations.
* *
@ -14,8 +13,7 @@ class AddInvoiceFontSupport extends Migration {
{ {
Schema::dropIfExists('fonts'); Schema::dropIfExists('fonts');
Schema::create('fonts', function($t) Schema::create('fonts', function ($t) {
{
$t->increments('id'); $t->increments('id');
$t->string('name'); $t->string('name');
@ -27,6 +25,7 @@ class AddInvoiceFontSupport extends Migration {
$t->string('bold'); $t->string('bold');
$t->string('italics'); $t->string('italics');
$t->string('bolditalics'); $t->string('bolditalics');
$t->boolean('early_access');
$t->unsignedInteger('sort_order')->default(10000); $t->unsignedInteger('sort_order')->default(10000);
}); });
@ -34,14 +33,12 @@ class AddInvoiceFontSupport extends Migration {
$seeder = new FontsSeeder(); $seeder = new FontsSeeder();
$seeder->run(); $seeder->run();
Schema::table('accounts', function($table) Schema::table('accounts', function ($table) {
{
$table->unsignedInteger('header_font_id')->default(1); $table->unsignedInteger('header_font_id')->default(1);
$table->unsignedInteger('body_font_id')->default(1); $table->unsignedInteger('body_font_id')->default(1);
}); });
Schema::table('accounts', function($table) Schema::table('accounts', function ($table) {
{
$table->foreign('header_font_id')->references('id')->on('fonts'); $table->foreign('header_font_id')->references('id')->on('fonts');
$table->foreign('body_font_id')->references('id')->on('fonts'); $table->foreign('body_font_id')->references('id')->on('fonts');
}); });
@ -54,19 +51,15 @@ class AddInvoiceFontSupport extends Migration {
*/ */
public function down() public function down()
{ {
if (Schema::hasColumn('accounts', 'header_font_id')) if (Schema::hasColumn('accounts', 'header_font_id')) {
{ Schema::table('accounts', function ($table) {
Schema::table('accounts', function($table)
{
$table->dropForeign('accounts_header_font_foreign'); $table->dropForeign('accounts_header_font_foreign');
$table->dropColumn('header_font_id'); $table->dropColumn('header_font_id');
}); });
} }
if (Schema::hasColumn('accounts', 'body_font_id')) if (Schema::hasColumn('accounts', 'body_font_id')) {
{ Schema::table('accounts', function ($table) {
Schema::table('accounts', function($table)
{
$table->dropForeign('accounts_body_font_foreign'); $table->dropForeign('accounts_body_font_foreign');
$table->dropColumn('body_font_id'); $table->dropColumn('body_font_id');
}); });
@ -74,5 +67,4 @@ class AddInvoiceFontSupport extends Migration {
Schema::dropIfExists('fonts'); Schema::dropIfExists('fonts');
} }
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long