fix migration for sqlite users (#985)
This commit is contained in:
@@ -52,6 +52,13 @@ abstract class AbstractMigration extends BaseAbstractMigration implements Contai
|
|||||||
return 'kimai2_' . $name;
|
return 'kimai2_' . $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether we should deactivate foreign key support for SQLite.
|
||||||
|
* This is required, if columns are changed.
|
||||||
|
* SQLite will drop the table and therefor all referenced data if we don't deactivate this.
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
protected function isSupportingForeignKeys(): bool
|
protected function isSupportingForeignKeys(): bool
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -26,6 +26,21 @@ final class Version20190706224219 extends AbstractMigration
|
|||||||
return 'Creates several indices to improve speed for default queries.';
|
return 'Creates several indices to improve speed for default queries.';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function isSupportingForeignKeys(): bool
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isTransactional(): bool
|
||||||
|
{
|
||||||
|
if ($this->isPlatformSqlite()) {
|
||||||
|
// does fail if we use transactions, as tables are re-created and foreign keys would fail
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public function up(Schema $schema): void
|
public function up(Schema $schema): void
|
||||||
{
|
{
|
||||||
$timesheet = $schema->getTable('kimai2_timesheet');
|
$timesheet = $schema->getTable('kimai2_timesheet');
|
||||||
|
|||||||
Reference in New Issue
Block a user