dbdeploy: undelete table works

This commit is contained in:
Jan Prochazka
2024-10-31 14:03:44 +01:00
parent d905962298
commit 5d4d2a447a
2 changed files with 125 additions and 7 deletions

View File

@@ -503,6 +503,7 @@ describe('Deploy database', () => {
},
],
[],
[],
],
{
dbdiffOptionsExtra: {
@@ -510,6 +511,7 @@ describe('Deploy database', () => {
deletedColumnPrefix: '_deleted_',
deletedSqlObjectPrefix: '_deleted_',
},
disallowExtraObjects: true,
finalCheckAgainstModel: [
{
name: 't1.table.yaml',
@@ -573,6 +575,7 @@ describe('Deploy database', () => {
deletedColumnPrefix: '_deleted_',
deletedSqlObjectPrefix: '_deleted_',
},
disallowExtraObjects: true,
finalCheckAgainstModel: [
{
name: 't1.table.yaml',
@@ -633,6 +636,7 @@ describe('Deploy database', () => {
deletedColumnPrefix: '_deleted_',
deletedSqlObjectPrefix: '_deleted_',
},
disallowExtraObjects: true,
finalCheckAgainstModel: [
{
name: 't1.table.yaml',
@@ -650,4 +654,67 @@ describe('Deploy database', () => {
);
})
);
test.each(engines.map(engine => [engine.label, engine]))(
'Undelete table - %s',
testWrapper(async (conn, driver, engine) => {
await testDatabaseDeploy(
engine,
conn,
driver,
[
[
{
name: 't1.table.yaml',
json: {
name: 't1',
columns: [
{ name: 'id', type: 'int' },
{ name: 'val', type: 'int' },
],
primaryKey: ['id'],
},
},
],
// delete table
[],
// undelete table
[
{
name: 't1.table.yaml',
json: {
name: 't1',
columns: [
{ name: 'id', type: 'int' },
{ name: 'val', type: 'int' },
],
primaryKey: ['id'],
},
},
],
],
{
dbdiffOptionsExtra: {
deletedTablePrefix: '_deleted_',
deletedColumnPrefix: '_deleted_',
deletedSqlObjectPrefix: '_deleted_',
},
disallowExtraObjects: true,
finalCheckAgainstModel: [
{
name: 't1.table.yaml',
json: {
name: 't1',
columns: [
{ name: 'id', type: 'int' },
{ name: 'val', type: 'int' },
],
primaryKey: ['id'],
},
},
],
}
);
})
);
});