Store set types
This commit is contained in:
parent
ed7ac88db0
commit
4a0fc6e539
2 changed files with 10 additions and 4 deletions
4
postgres/004-set-type.sql
Normal file
4
postgres/004-set-type.sql
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
ALTER TABLE "sets"
|
||||||
|
ADD COLUMN IF NOT EXISTS "set_type" TEXT NOT NULL DEFAULT 'core';
|
||||||
|
|
||||||
|
CREATE INDEX IF NOT EXISTS "sets_type" ON "sets" ("set_type");
|
|
@ -335,14 +335,16 @@ async def store_price(
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
async def store_set(db: psycopg.AsyncCursor, set_code: str, name: str) -> None:
|
async def store_set(
|
||||||
|
db: psycopg.AsyncCursor, set_code: str, set_type: str, name: str
|
||||||
|
) -> None:
|
||||||
await db.execute(
|
await db.execute(
|
||||||
"""
|
"""
|
||||||
INSERT INTO "sets" ("set_code", "name")
|
INSERT INTO "sets" ("set_code", "set_type", "name")
|
||||||
VALUES (%(set_code)s, %(name)s)
|
VALUES (%(set_code)s, %(set_type)s, %(name)s)
|
||||||
ON CONFLICT ("set_code") DO NOTHING
|
ON CONFLICT ("set_code") DO NOTHING
|
||||||
""",
|
""",
|
||||||
{"set_code": set_code, "name": name},
|
{"set_code": set_code, "set_type": set_type, "name": name},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue