mirror of
https://github.com/lnbits/lnbits-legend.git
synced 2025-02-24 14:51:05 +01:00
a big refactor that: - fixes some issues that might have happened (or not) with asynchronous reactions to payments; - paves the way to https://github.com/lnbits/lnbits/issues/121; - uses more async/await notation which just looks nice; and - makes it simple(r?) for one extension to modify stuff from other extensions.
60 lines
1.5 KiB
Python
60 lines
1.5 KiB
Python
async def m001_initial(db):
|
|
"""
|
|
Initial products table.
|
|
"""
|
|
await db.execute(
|
|
"""
|
|
CREATE TABLE IF NOT EXISTS products (
|
|
id TEXT PRIMARY KEY,
|
|
wallet TEXT NOT NULL,
|
|
product TEXT NOT NULL,
|
|
categories TEXT NOT NULL,
|
|
description TEXT NOT NULL,
|
|
image TEXT NOT NULL,
|
|
price INTEGER NOT NULL,
|
|
quantity INTEGER NOT NULL
|
|
);
|
|
"""
|
|
)
|
|
|
|
"""
|
|
Initial indexers table.
|
|
"""
|
|
await db.execute(
|
|
"""
|
|
CREATE TABLE IF NOT EXISTS indexers (
|
|
id TEXT PRIMARY KEY,
|
|
wallet TEXT NOT NULL,
|
|
shopname TEXT NOT NULL,
|
|
indexeraddress TEXT NOT NULL,
|
|
online BOOLEAN NOT NULL,
|
|
rating INTEGER NOT NULL,
|
|
shippingzone1 TEXT NOT NULL,
|
|
shippingzone2 TEXT NOT NULL,
|
|
zone1cost INTEGER NOT NULL,
|
|
zone2cost INTEGER NOT NULL,
|
|
email TEXT NOT NULL
|
|
);
|
|
"""
|
|
)
|
|
|
|
"""
|
|
Initial orders table.
|
|
"""
|
|
await db.execute(
|
|
"""
|
|
CREATE TABLE IF NOT EXISTS orders (
|
|
id TEXT PRIMARY KEY,
|
|
productid TEXT NOT NULL,
|
|
wallet TEXT NOT NULL,
|
|
product TEXT NOT NULL,
|
|
quantity INTEGER NOT NULL,
|
|
shippingzone INTEGER NOT NULL,
|
|
address TEXT NOT NULL,
|
|
email TEXT NOT NULL,
|
|
invoiceid TEXT NOT NULL,
|
|
paid BOOLEAN NOT NULL,
|
|
shipped BOOLEAN NOT NULL
|
|
);
|
|
"""
|
|
)
|