chore: generate
This commit is contained in:
parent
ffcb7542e1
commit
24ea4dd008
1 changed files with 9 additions and 15 deletions
|
|
@ -6,17 +6,14 @@ const checkOnly = process.argv.includes("--check")
|
||||||
|
|
||||||
const client = new Client({ url: databaseUrl() })
|
const client = new Client({ url: databaseUrl() })
|
||||||
|
|
||||||
const missing = await tables.reduce<Promise<(typeof tables)[number][]>>(
|
const missing = await tables.reduce<Promise<(typeof tables)[number][]>>(async (promise, table) => {
|
||||||
async (promise, table) => {
|
const result = await promise
|
||||||
const result = await promise
|
if (await hasUniqueUsersColumn(table)) {
|
||||||
if (await hasUniqueUsersColumn(table)) {
|
console.log(`unique_users column already exists on ${table}`)
|
||||||
console.log(`unique_users column already exists on ${table}`)
|
return result
|
||||||
return result
|
}
|
||||||
}
|
return [...result, table]
|
||||||
return [...result, table]
|
}, Promise.resolve([]))
|
||||||
},
|
|
||||||
Promise.resolve([]),
|
|
||||||
)
|
|
||||||
|
|
||||||
if (missing.length === 0) {
|
if (missing.length === 0) {
|
||||||
console.log("unique_users columns complete")
|
console.log("unique_users columns complete")
|
||||||
|
|
@ -28,10 +25,7 @@ if (checkOnly) {
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
await missing.reduce(
|
await missing.reduce((promise, table) => promise.then(() => addUniqueUsersColumn(table)), Promise.resolve())
|
||||||
(promise, table) => promise.then(() => addUniqueUsersColumn(table)),
|
|
||||||
Promise.resolve(),
|
|
||||||
)
|
|
||||||
|
|
||||||
function databaseUrl() {
|
function databaseUrl() {
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue