lnbits-legend/lnbits/extensions/offlineshop/migrations.py
2021-10-25 18:42:36 +01:00

30 lines
791 B
Python

async def m001_initial(db):
"""
Initial offlineshop tables.
"""
await db.execute(
f"""
CREATE TABLE offlineshop.shops (
id {db.serial_primary_key},
wallet TEXT NOT NULL,
method TEXT NOT NULL,
wordlist TEXT
);
"""
)
await db.execute(
f"""
CREATE TABLE offlineshop.items (
shop INTEGER NOT NULL REFERENCES {db.references_schema}shops (id),
id {db.serial_primary_key},
name TEXT NOT NULL,
description TEXT NOT NULL,
image TEXT, -- image/png;base64,...
enabled BOOLEAN NOT NULL DEFAULT true,
price INTEGER NOT NULL,
unit TEXT NOT NULL DEFAULT 'sat'
);
"""
)