Splitting app migrations for SQS into their own environment variable so that they can be enabled separately.
This commit is contained in:
parent
d15ab0b871
commit
056d65cb1e
|
@ -10,6 +10,6 @@ export const MIGRATIONS: AppMigration[] = [
|
||||||
{
|
{
|
||||||
id: "20240604153647_initial_sqs",
|
id: "20240604153647_initial_sqs",
|
||||||
func: m20240604153647_initial_sqs,
|
func: m20240604153647_initial_sqs,
|
||||||
disabled: !env.SQS_SEARCH_ENABLE,
|
disabled: !env.SQS_MIGRATION_ENABLE,
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|
|
@ -40,7 +40,7 @@ const migration = async () => {
|
||||||
// only do initial search if environment is using SQS already
|
// only do initial search if environment is using SQS already
|
||||||
// initial search makes sure that all the indexes have been created
|
// initial search makes sure that all the indexes have been created
|
||||||
// and are ready to use, avoiding any initial waits for large tables
|
// and are ready to use, avoiding any initial waits for large tables
|
||||||
if (env.SQS_SEARCH_ENABLE) {
|
if (env.SQS_MIGRATION_ENABLE) {
|
||||||
const tables = await sdk.tables.getAllInternalTables()
|
const tables = await sdk.tables.getAllInternalTables()
|
||||||
// do these one by one - running in parallel could cause problems
|
// do these one by one - running in parallel could cause problems
|
||||||
for (let table of tables) {
|
for (let table of tables) {
|
||||||
|
|
|
@ -67,11 +67,11 @@ function oldLinkDocument(): Omit<LinkDocument, "tableId"> {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sqsDisabled(cb: () => Promise<void>) {
|
async function sqsDisabled(cb: () => Promise<void>) {
|
||||||
await config.withEnv({ SQS_SEARCH_ENABLE: "" }, cb)
|
await config.withEnv({ SQS_MIGRATION_ENABLE: "" }, cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
async function sqsEnabled(cb: () => Promise<void>) {
|
async function sqsEnabled(cb: () => Promise<void>) {
|
||||||
await config.withEnv({ SQS_SEARCH_ENABLE: "1" }, cb)
|
await config.withEnv({ SQS_MIGRATION_ENABLE: "1" }, cb)
|
||||||
}
|
}
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
|
|
|
@ -92,6 +92,7 @@ const environment = {
|
||||||
SQL_LOGGING_ENABLE: process.env.SQL_LOGGING_ENABLE,
|
SQL_LOGGING_ENABLE: process.env.SQL_LOGGING_ENABLE,
|
||||||
SQL_ALIASING_DISABLE: process.env.SQL_ALIASING_DISABLE,
|
SQL_ALIASING_DISABLE: process.env.SQL_ALIASING_DISABLE,
|
||||||
SQS_SEARCH_ENABLE: process.env.SQS_SEARCH_ENABLE,
|
SQS_SEARCH_ENABLE: process.env.SQS_SEARCH_ENABLE,
|
||||||
|
SQS_MIGRATION_ENABLE: process.env.SQS_MIGRATION_ENABLE,
|
||||||
// flags
|
// flags
|
||||||
ALLOW_DEV_AUTOMATIONS: process.env.ALLOW_DEV_AUTOMATIONS,
|
ALLOW_DEV_AUTOMATIONS: process.env.ALLOW_DEV_AUTOMATIONS,
|
||||||
DISABLE_THREADING: process.env.DISABLE_THREADING,
|
DISABLE_THREADING: process.env.DISABLE_THREADING,
|
||||||
|
|
Loading…
Reference in New Issue