Merge migrations

This commit is contained in:
Hillel Coren 2016-07-10 12:45:42 +03:00
parent 6756fde908
commit 3ae8df3fdf
3 changed files with 84 additions and 65 deletions

View File

@ -1,34 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
/**
* Class AddStartOfWeekToAccountsTable
*/
class AddStartOfWeekToAccountsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('accounts', function (Blueprint $table) {
$table->integer('start_of_week');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('accounts', function (Blueprint $table) {
$table->dropColumn('start_of_week');
});
}
}

View File

@ -1,31 +0,0 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddTaskIdToActivityTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('activities', function (Blueprint $table) {
$table->integer('task_id')->after('invitation_id')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('activities', function (Blueprint $table) {
$table->dropColumn('task_id');
});
}
}

View File

@ -0,0 +1,84 @@
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class SupportNewPricing extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('companies', function (Blueprint $table)
{
$table->decimal('price', 7, 2)->nullable();
$table->smallInteger('num_users')->default(1);
});
// lock in existing prices
DB::table('companies')->where('plan', 'pro')->where('plan_term', 'month')->update(['price' => 5]);
DB::table('companies')->where('plan', 'pro')->where('plan_term', 'year')->update(['price' => 50]);
DB::table('companies')->where('plan', 'enterprise')->where('plan_term', 'month')->update(['price' => 10]);
DB::table('companies')->where('plan', 'enterprise')->where('plan_term', 'year')->update(['price' => 100]);
DB::table('companies')->where('plan', 'enterprise')->update(['num_users' => 5]);
// https://github.com/invoiceninja/invoiceninja/pull/955
Schema::table('activities', function (Blueprint $table) {
$table->integer('task_id')->after('invitation_id')->nullable();
});
// https://github.com/invoiceninja/invoiceninja/pull/950
Schema::table('accounts', function (Blueprint $table) {
$table->integer('start_of_week');
});
// https://github.com/invoiceninja/invoiceninja/pull/959
Schema::create('jobs', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('queue');
$table->longText('payload');
$table->tinyInteger('attempts')->unsigned();
$table->tinyInteger('reserved')->unsigned();
$table->unsignedInteger('reserved_at')->nullable();
$table->unsignedInteger('available_at');
$table->unsignedInteger('created_at');
$table->index(['queue', 'reserved', 'reserved_at']);
});
Schema::create('failed_jobs', function (Blueprint $table) {
$table->increments('id');
$table->text('connection');
$table->text('queue');
$table->longText('payload');
$table->timestamp('failed_at')->useCurrent();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('companies', function (Blueprint $table)
{
$table->dropColumn('price');
$table->dropColumn('num_users');
});
Schema::table('activities', function (Blueprint $table) {
$table->dropColumn('task_id');
});
Schema::table('accounts', function (Blueprint $table) {
$table->dropColumn('start_of_week');
});
Schema::drop('jobs');
Schema::drop('failed_jobs');
}
}