Skip to content

Commit

Permalink
prevent empty migration warning
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpapst committed Nov 21, 2024
1 parent 1191d9f commit 2047a50
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Migrations/Version20240917151424.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ public function up(Schema $schema): void
// likely an older installation without the latest features, only import the columns available since 2020
$this->addSql('INSERT INTO kimai2_customer_portals (`share_key`, `project_id`, `customer_id`, `password`, `entry_user_visible`, `entry_rate_visible`, `record_merge_mode`, `annual_chart_visible`, `monthly_chart_visible`)
SELECT `share_key`, `project_id`, null, `password`, `entry_user_visible`, `entry_rate_visible`, `record_merge_mode`, `annual_chart_visible`, `monthly_chart_visible` FROM kimai2_shared_project_timesheets');
} else {
$this->preventEmptyMigrationWarning();
}
}

public function down(Schema $schema): void
{
$this->preventEmptyMigrationWarning();
}
}
7 changes: 7 additions & 0 deletions Migrations/Version20240917151425.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,22 @@ public function getDescription(): string

public function up(Schema $schema): void
{
$sawTable = false;
if ($schema->hasTable('kimai2_shared_project_timesheets')) {
$schema->dropTable('kimai2_shared_project_timesheets');
$sawTable = true;
}
if ($schema->hasTable('bundle_migration_shared_project_timesheets')) {
$schema->dropTable('bundle_migration_shared_project_timesheets');
$sawTable = true;
}
if (!$sawTable) {
$this->preventEmptyMigrationWarning();
}
}

public function down(Schema $schema): void
{
$this->preventEmptyMigrationWarning();
}
}

0 comments on commit 2047a50

Please sign in to comment.