This commit is contained in:
Jan Prochazka
2024-11-11 16:09:18 +01:00
parent cbd857422f
commit 25d3dcad59
2 changed files with 6 additions and 1 deletions

View File

@@ -638,6 +638,10 @@ describe('Deploy database', () => {
testWrapper(async (conn, driver, engine) => { testWrapper(async (conn, driver, engine) => {
await testDatabaseDeploy(engine, conn, driver, [ await testDatabaseDeploy(engine, conn, driver, [
[ [
{
name: 't1.uninstall.sql',
text: 'drop table t1',
},
{ {
name: 't1.install.sql', name: 't1.install.sql',
text: 'create table t1 (id int primary key); insert into t1 (id) values (1)', text: 'create table t1 (id int primary key); insert into t1 (id) values (1)',

View File

@@ -161,7 +161,8 @@ export class ScriptDrivedDeployer {
case 'install': case 'install':
if (isEqual) return; if (isEqual) return;
const uninstallFile = this.uninstall.find(x => x.name == file.name.replace('.install.sql', '.uninstall.sql')); const uninstallFile = this.uninstall.find(x => x.name == file.name.replace('.install.sql', '.uninstall.sql'));
if (uninstallFile) { if (uninstallFile && journalItem) {
// file was previously installed, uninstall first
await this.runFileCore( await this.runFileCore(
uninstallFile, uninstallFile,
'uninstall', 'uninstall',