Fix migrations.

This commit is contained in:
James Cole 2016-04-30 07:15:28 +02:00
parent e4f45b5370
commit 11ea4b6d47
2 changed files with 19 additions and 6 deletions

View File

@ -2,7 +2,7 @@
return [
'chart' => 'chartjs',
'version' => '3.8.4',
'version' => '3.9.0',
'index_periods' => ['1D', '1W', '1M', '3M', '6M', '1Y', 'custom'],
'budget_periods' => ['daily', 'weekly', 'monthly', 'quarterly', 'half-year', 'yearly'],
'csv_import_enabled' => true,

View File

@ -5,9 +5,9 @@ use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
/**
* Class ChangesForV385
* Class ChangesForV390
*/
class ChangesForV385 extends Migration
class ChangesForV390 extends Migration
{
/**
* Reverse the migrations.
@ -16,6 +16,14 @@ class ChangesForV385 extends Migration
*/
public function down()
{
// restore removed unique index. Recreate it the correct way:
Schema::table(
'budget_limits', function (Blueprint $table) {
$table->unique(['budget_id', 'startdate', 'repeat_freq'], 'unique_bl_combi');
}
);
$backup = $this->backupRepeatFreqsFromString();
// drop string and create enum field
@ -48,15 +56,21 @@ class ChangesForV385 extends Migration
*/
public function up()
{
// remove an index.
// // remove an index.
Schema::table(
'budget_limits', function (Blueprint $table) {
$table->dropForeign('bid_foreign');
}
);
Schema::table(
'budget_limits', function (Blueprint $table) {
$table->dropUnique('unique_limit');
$table->dropForeign('bid_foreign');
$table->dropUnique('unique_bl_combi');
}
);
// recreate foreign key:
Schema::table(
'budget_limits', function (Blueprint $table) {
@ -65,7 +79,6 @@ class ChangesForV385 extends Migration
);
// backup values
$backup = $this->backupRepeatFreqsFromEnum();