mirror of
https://github.com/strapi/strapi.git
synced 2025-11-03 03:17:11 +00:00
finally drop temp table
This commit is contained in:
parent
e2234ed9f1
commit
306d5c4abc
@ -295,6 +295,7 @@ const cleanOrderColumnsForOldDatabases = async ({
|
||||
|
||||
if (hasOrderColumn(attribute) && id) {
|
||||
const tempOrderTableName = `tempOrderTableName_${now}`;
|
||||
try {
|
||||
await db.connection
|
||||
.raw(
|
||||
`
|
||||
@ -324,10 +325,16 @@ const cleanOrderColumnsForOldDatabases = async ({
|
||||
[joinTable.name, tempOrderTableName, orderColumnName]
|
||||
)
|
||||
.transacting(trx);
|
||||
await db.connection.raw(`DROP TEMPORARY TABLE ${tempOrderTableName}`).transacting(trx);
|
||||
} finally {
|
||||
await db.connection
|
||||
.raw(`DROP TEMPORARY TABLE IF EXISTS ${tempOrderTableName}`)
|
||||
.transacting(trx);
|
||||
}
|
||||
}
|
||||
|
||||
if (hasInverseOrderColumn(attribute) && !isEmpty(inverseRelIds)) {
|
||||
const tempInvOrderTableName = `tempInvOrderTableName_${now}`;
|
||||
try {
|
||||
await db.connection
|
||||
.raw(
|
||||
`
|
||||
@ -363,7 +370,11 @@ const cleanOrderColumnsForOldDatabases = async ({
|
||||
[joinTable.name, tempInvOrderTableName, inverseOrderColumnName]
|
||||
)
|
||||
.transacting(trx);
|
||||
await db.connection.raw(`DROP TEMPORARY TABLE ${tempInvOrderTableName}`).transacting(trx);
|
||||
} finally {
|
||||
await db.connection
|
||||
.raw(`DROP TEMPORARY TABLE IF EXISTS ${tempInvOrderTableName}`)
|
||||
.transacting(trx);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user