Lets see if this fixes the database.

This commit is contained in:
James Cole 2015-06-23 07:38:48 +02:00
parent 1511f75a80
commit cc55e2acee
5 changed files with 113 additions and 0 deletions

View File

@ -42,6 +42,9 @@ class CreatePiggybanksTable extends Migration
$table->enum('rep_length', ['day', 'week', 'quarter', 'month', 'year'])->nullable();
$table->smallInteger('rep_every')->unsigned();
$table->smallInteger('rep_times')->unsigned()->nullable();
$table->enum('reminder', ['day', 'week', 'quarter', 'month', 'year'])->nullable();
$table->smallInteger('reminder_skip')->unsigned();
$table->boolean('remind_me');
$table->integer('order')->unsigned();
// connect account to piggy bank.

View File

@ -0,0 +1,50 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
/**
* @SuppressWarnings(PHPMD.ShortMethodName)
*
* Class CreateRemindersTable
*
*/
class CreateRemindersTable extends Migration
{
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('reminders');
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create(
'reminders', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->integer('user_id')->unsigned();
$table->date('startdate');
$table->date('enddate')->nullable();
$table->boolean('active');
$table->boolean('notnow')->default(0);
$table->integer('remindersable_id')->unsigned()->nullable();
$table->string('remindersable_type')->nullable();
// connect reminders to users
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
}
);
}
}

View File

@ -35,6 +35,15 @@ class ChangesForV332 extends Migration
}
);
Schema::table(
'reminders', function (Blueprint $table) {
$table->text('metadata')->nullable();
}
);
}
}

View File

@ -226,6 +226,17 @@ class ChangesForV336 extends Migration
}
);
/**
* REMINDERS
*/
Schema::table(
'reminders', function (Blueprint $table) {
$table->smallInteger('encrypted', false, true)->default(0);
}
);
}
}

View File

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
/**
* Class ChangesForV3451
*/
class ChangesForV3451 extends Migration
{
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::statement('UPDATE `piggy_banks` SET `reminder_skip` = 0 WHERE `reminder_skip` IS NULL;');
DB::statement('ALTER TABLE `piggy_banks` MODIFY `reminder_skip` SMALLINT UNSIGNED NOT NULL;');
DB::statement('UPDATE `piggy_banks` SET `remind_me` = 0 WHERE `remind_me` IS NULL;');
DB::statement('ALTER TABLE `piggy_banks` MODIFY `remind_me` TINYINT UNSIGNED NOT NULL;');
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::statement('ALTER TABLE `piggy_banks` MODIFY `reminder_skip` SMALLINT UNSIGNED NULL;');
DB::statement('ALTER TABLE `piggy_banks` MODIFY `remind_me` TINYINT UNSIGNED NULL;');
//'reminder_skip'
//'remind_me'
}
}