mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-10 00:20:49 +00:00
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 missing = await tables.reduce<Promise<(typeof tables)[number][]>>(
|
||||
async (promise, table) => {
|
||||
const result = await promise
|
||||
if (await hasUniqueUsersColumn(table)) {
|
||||
console.log(`unique_users column already exists on ${table}`)
|
||||
return result
|
||||
}
|
||||
return [...result, table]
|
||||
},
|
||||
Promise.resolve([]),
|
||||
)
|
||||
const missing = await tables.reduce<Promise<(typeof tables)[number][]>>(async (promise, table) => {
|
||||
const result = await promise
|
||||
if (await hasUniqueUsersColumn(table)) {
|
||||
console.log(`unique_users column already exists on ${table}`)
|
||||
return result
|
||||
}
|
||||
return [...result, table]
|
||||
}, Promise.resolve([]))
|
||||
|
||||
if (missing.length === 0) {
|
||||
console.log("unique_users columns complete")
|
||||
|
|
@ -28,10 +25,7 @@ if (checkOnly) {
|
|||
process.exit(1)
|
||||
}
|
||||
|
||||
await missing.reduce(
|
||||
(promise, table) => promise.then(() => addUniqueUsersColumn(table)),
|
||||
Promise.resolve(),
|
||||
)
|
||||
await missing.reduce((promise, table) => promise.then(() => addUniqueUsersColumn(table)), Promise.resolve())
|
||||
|
||||
function databaseUrl() {
|
||||
if (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue