mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-13 16:00:13 +00:00
Something with migrations.
This commit is contained in:
@@ -29,19 +29,19 @@ class CreateLimitsTable extends Migration
|
|||||||
{
|
{
|
||||||
Schema::create(
|
Schema::create(
|
||||||
'limits', function (Blueprint $table) {
|
'limits', function (Blueprint $table) {
|
||||||
$table->increments('id');
|
$table->increments('id');
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
$table->integer('component_id')->unsigned();
|
$table->integer('component_id')->unsigned();
|
||||||
$table->date('startdate');
|
$table->date('startdate');
|
||||||
$table->decimal('amount', 10, 2);
|
$table->decimal('amount', 10, 2);
|
||||||
$table->boolean('repeats');
|
$table->boolean('repeats');
|
||||||
$table->enum('repeat_freq', ['daily', 'weekly', 'monthly', 'quarterly', 'half-year', 'yearly']);
|
$table->enum('repeat_freq', ['daily', 'weekly', 'monthly', 'quarterly', 'half-year', 'yearly']);
|
||||||
|
|
||||||
$table->unique(['component_id', 'startdate', 'repeat_freq']);
|
$table->unique(['component_id', 'startdate', 'repeat_freq'], 'unique_ci_combi');
|
||||||
|
|
||||||
// connect component
|
// connect component
|
||||||
$table->foreign('component_id')->references('id')->on('components')->onDelete('cascade');
|
$table->foreign('component_id')->references('id')->on('components')->onDelete('cascade');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Illuminate\Database\Migrations\Migration;
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\QueryException;
|
||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -50,10 +51,18 @@ class ChangesForV322 extends Migration
|
|||||||
Schema::rename('piggybank_repetitions', 'piggy_bank_repetitions');
|
Schema::rename('piggybank_repetitions', 'piggy_bank_repetitions');
|
||||||
Schema::rename('piggybanks', 'piggy_banks');
|
Schema::rename('piggybanks', 'piggy_banks');
|
||||||
|
|
||||||
// drop an invalid index.
|
// drop an invalid index (how, in sqlite?).
|
||||||
Schema::table(
|
Schema::table(
|
||||||
'budget_limits', function (Blueprint $table) {
|
'budget_limits', function (Blueprint $table) {
|
||||||
$table->dropIndex('limits_component_id_startdate_repeat_freq_unique');
|
|
||||||
|
// try {
|
||||||
|
//$table->dropUnique('limits_component_id_startdate_repeat_freq_unique');
|
||||||
|
// } catch (QueryException $e) {
|
||||||
|
//$table->dropUnique('unique_ci_combi');
|
||||||
|
// } catch (PDOException $e) {
|
||||||
|
// $table->dropUnique('unique_ci_combi');
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
// recreate it the correct way:
|
// recreate it the correct way:
|
||||||
|
Reference in New Issue
Block a user