diff --git a/database/migrations/2016_07_04_110152_add_start_of_week_to_accounts_table.php b/database/migrations/2016_07_04_110152_add_start_of_week_to_accounts_table.php deleted file mode 100644 index 5c4eb858c852..000000000000 --- a/database/migrations/2016_07_04_110152_add_start_of_week_to_accounts_table.php +++ /dev/null @@ -1,34 +0,0 @@ -integer('start_of_week'); - }); - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - Schema::table('accounts', function (Blueprint $table) { - $table->dropColumn('start_of_week'); - }); - } -} diff --git a/database/migrations/2016_07_05_140904_add_task_id_to_activity_table.php b/database/migrations/2016_07_05_140904_add_task_id_to_activity_table.php deleted file mode 100644 index 9f3f03ab7f4f..000000000000 --- a/database/migrations/2016_07_05_140904_add_task_id_to_activity_table.php +++ /dev/null @@ -1,31 +0,0 @@ -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'); - }); - } -} diff --git a/database/migrations/2016_07_08_083802_support_new_pricing.php b/database/migrations/2016_07_08_083802_support_new_pricing.php new file mode 100644 index 000000000000..94b53850e7ca --- /dev/null +++ b/database/migrations/2016_07_08_083802_support_new_pricing.php @@ -0,0 +1,84 @@ +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'); + } +}