forked from cadence/out-of-your-element
Upload web code
This commit is contained in:
parent
1d2daf2504
commit
b6c23c30fb
22 changed files with 765 additions and 6 deletions
5
src/db/migrations/0014-add-guild-autocreate.sql
Normal file
5
src/db/migrations/0014-add-guild-autocreate.sql
Normal file
|
@ -0,0 +1,5 @@
|
|||
BEGIN TRANSACTION;
|
||||
|
||||
ALTER TABLE guild_space ADD COLUMN autocreate INTEGER NOT NULL DEFAULT 1;
|
||||
|
||||
COMMIT;
|
1
src/db/orm-defs.d.ts
vendored
1
src/db/orm-defs.d.ts
vendored
|
@ -31,6 +31,7 @@ export type Models = {
|
|||
guild_id: string
|
||||
space_id: string
|
||||
privacy_level: number
|
||||
autocreate: number
|
||||
}
|
||||
|
||||
lottie: {
|
||||
|
|
|
@ -15,8 +15,13 @@ function select(table, cols, where = {}, e = "") {
|
|||
if (!Array.isArray(cols)) cols = [cols]
|
||||
const parameters = []
|
||||
const wheres = Object.entries(where).map(([col, value]) => {
|
||||
parameters.push(value)
|
||||
return `"${col}" = ?`
|
||||
if (Array.isArray(value)) {
|
||||
parameters.push(...value)
|
||||
return `"${col}" IN (` + Array(value.length).fill("?").join(", ") + ")"
|
||||
} else {
|
||||
parameters.push(value)
|
||||
return `"${col}" = ?`
|
||||
}
|
||||
})
|
||||
const whereString = wheres.length ? " WHERE " + wheres.join(" AND ") : ""
|
||||
/** @type {U.Prepared<Pick<U.Models[Table], Col>>} */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue