Skip to content

Commit

Permalink
#145 Run upgrade process
Browse files Browse the repository at this point in the history
  • Loading branch information
danielbrendel committed Mar 30, 2024
1 parent a3e6f7c commit 908f85a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/commands/MigrationUpgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ class MigrationUpgrade implements Asatru\Commands\Command {
*/
public function upgradeTo2dot5()
{
PlantsModel::raw('ALTER TABLE `' . PlantsModel::tableName() . '` ADD COLUMN last_fertilised DATETIME NULL');
PlantsModel::raw('ALTER TABLE `' . PlantsModel::tableName() . '` ADD COLUMN IF NOT EXISTS last_fertilised DATETIME NULL');

UserModel::raw('ALTER TABLE `' . UserModel::tableName() . '` ADD COLUMN notify_calendar BOOLEAN NOT NULL DEFAULT 1');
UserModel::raw('ALTER TABLE `' . UserModel::tableName() . '` ADD COLUMN IF NOT EXISTS notify_calendar_reminder BOOLEAN NOT NULL DEFAULT 1');
}

/**
* @return void
*/
public function upgradeTo2dot4()
{
UserModel::raw('ALTER TABLE `' . UserModel::tableName() . '` DROP COLUMN session');
UserModel::raw('ALTER TABLE `' . UserModel::tableName() . '` DROP COLUMN status');
UserModel::raw('ALTER TABLE `' . UserModel::tableName() . '` DROP COLUMN IF EXISTS session');
UserModel::raw('ALTER TABLE `' . UserModel::tableName() . '` DROP COLUMN IF EXISTS status');

PlantsModel::raw('ALTER TABLE `' . PlantsModel::tableName() . '` MODIFY COLUMN perennial BOOLEAN NULL');
PlantsModel::raw('ALTER TABLE `' . PlantsModel::tableName() . '` MODIFY COLUMN humidity INT NULL');
Expand Down
1 change: 1 addition & 0 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ if [ $(mysql -u "$DB_USERNAME" -p"$DB_PASSWORD" -h "$DB_HOST" -P "$DB_PORT" -D "
then
echo "Running unapplied database migrations..."
php asatru migrate:list
php asatru migrate:upgrade
else
echo "Running full database migrations..."
php asatru migrate:fresh
Expand Down

0 comments on commit 908f85a

Please sign in to comment.