Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"short_description": "A shareable PoS terminal!",
"description": "",
"tile": "/tpos/static/image/tpos.png",
"min_lnbits_version": "1.3.0",
"min_lnbits_version": "1.5.0",
"contributors": [
{
"name": "Ben Arc",
Expand Down
120 changes: 40 additions & 80 deletions migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,36 @@ async def m001_initial(db: Database):
"""
Initial tposs table.
"""
await db.execute(
"""
await db.execute("""
CREATE TABLE tpos.tposs (
id TEXT PRIMARY KEY,
wallet TEXT NOT NULL,
name TEXT NOT NULL,
currency TEXT NOT NULL
);
"""
)
""")


async def m002_addtip_wallet(db: Database):
"""
Add tips to tposs table
"""
await db.execute(
"""
await db.execute("""
ALTER TABLE tpos.tposs ADD tip_wallet TEXT NULL;
"""
)
""")


async def m003_addtip_options(db: Database):
"""
Add tips to tposs table
"""
await db.execute(
"""
await db.execute("""
ALTER TABLE tpos.tposs ADD tip_options TEXT NULL;
"""
)
""")


async def m004_addwithdrawlimit(db: Database):
await db.execute(
"""
await db.execute("""
CREATE TABLE tpos.pos (
id TEXT PRIMARY KEY,
wallet TEXT NOT NULL,
Expand All @@ -55,8 +48,7 @@ async def m004_addwithdrawlimit(db: Database):
withdrawtime INTEGER NOT NULL DEFAULT 0,
withdrawbtwn INTEGER NOT NULL DEFAULT 10
);
"""
)
""")
result = await db.execute("SELECT * FROM tpos.tposs")
rows = result.mappings().all()
for row in rows:
Expand Down Expand Up @@ -88,28 +80,24 @@ async def m005_initial(db: Database):
"""
Initial withdraws table.
"""
await db.execute(
"""
await db.execute("""
CREATE TABLE tpos.withdraws (
id TEXT PRIMARY KEY,
tpos_id TEXT NOT NULL,
amount int,
claimed BOOLEAN DEFAULT false
);
"""
)
""")


async def m006_items(db: Database):
"""
Add items to tpos table for storing various items (JSON format)
See `Item` class in models.
"""
await db.execute(
"""
await db.execute("""
ALTER TABLE tpos.pos ADD items TEXT DEFAULT '[]';
"""
)
""")


async def m007_atm_premium(db: Database):
Expand Down Expand Up @@ -146,8 +134,7 @@ async def m010_rename_tpos_withdraw_columns(db: Database):
"""
Add rename tpos withdraw columns
"""
await db.execute(
"""
await db.execute("""
CREATE TABLE tpos.pos_backup AS
SELECT
id, name, currency, items, wallet, tax_inclusive,
Expand All @@ -161,8 +148,7 @@ async def m010_rename_tpos_withdraw_columns(db: Database):
withdrawpindisabled AS withdraw_pin_disabled,
withdrawpin AS withdraw_pin
FROM tpos.pos
"""
)
""")
await db.execute("DROP TABLE tpos.pos")
await db.execute("ALTER TABLE tpos.pos_backup RENAME TO pos")

Expand All @@ -171,33 +157,27 @@ async def m011_lnaddress(db: Database):
"""
Add lnaddress to tpos table
"""
await db.execute(
"""
await db.execute("""
ALTER TABLE tpos.pos ADD lnaddress BOOLEAN DEFAULT false;
"""
)
""")


async def m012_addlnaddress(db: Database):
"""
Add lnaddress_cut to tpos table
"""
await db.execute(
"""
await db.execute("""
ALTER TABLE tpos.pos ADD lnaddress_cut INTEGER NULL;
"""
)
""")


async def m013_add_receipt_print(db: Database):
"""
Add enable_receipt_print to tpos table
"""
await db.execute(
"""
await db.execute("""
ALTER TABLE tpos.pos ADD enable_receipt_print BOOLEAN DEFAULT false;
"""
)
""")

await db.execute("ALTER TABLE tpos.pos ADD business_name TEXT;")
await db.execute("ALTER TABLE tpos.pos ADD business_address TEXT;")
Expand All @@ -208,95 +188,75 @@ async def m014_addfiat(db: Database):
"""
Add fiat invoicing to tpos table
"""
await db.execute(
"""
await db.execute("""
ALTER TABLE tpos.pos ADD fiat_provider TEXT NULL;
"""
)
""")


async def m015_addfiat(db: Database):
"""
Add fiat stripe_card_payments to tpos table
"""
await db.execute(
"""
await db.execute("""
ALTER TABLE tpos.pos ADD stripe_card_payments BOOLEAN DEFAULT false;
"""
)
""")


async def m016_add_inventory_settings(db: Database):
"""
Add inventory integration columns
"""
await db.execute(
"""
await db.execute("""
ALTER TABLE tpos.pos ADD use_inventory BOOLEAN DEFAULT false;
"""
)
await db.execute(
"""
""")
await db.execute("""
ALTER TABLE tpos.pos ADD inventory_id TEXT NULL;
"""
)
await db.execute(
"""
""")
await db.execute("""
ALTER TABLE tpos.pos ADD inventory_tags TEXT NULL;
"""
)
""")


async def m017_add_inventory_omit_tags(db: Database):
"""
Add inventory omit tags column
"""
await db.execute(
"""
await db.execute("""
ALTER TABLE tpos.pos ADD inventory_omit_tags TEXT NULL;
"""
)
""")


async def m018_add_stripe_reader_id(db: Database):
"""
Add Stripe reader id column
"""
await db.execute(
"""
await db.execute("""
ALTER TABLE tpos.pos ADD stripe_reader_id TEXT NULL;
"""
)
""")


async def m019_add_receipt_sats_only(db: Database):
"""
Add receipt option to only show sats on bitcoin transactions
"""
await db.execute(
"""
await db.execute("""
ALTER TABLE tpos.pos ADD only_show_sats_on_bitcoin BOOLEAN DEFAULT true;
"""
)
""")


async def m020_add_remote_mode_toggle(db: Database):
"""
Add enable_remote option for cross-device invoice triggering.
"""
await db.execute(
"""
await db.execute("""
ALTER TABLE tpos.pos ADD enable_remote BOOLEAN DEFAULT false;
"""
)
""")


async def m021_add_cash_settlement(db: Database):
"""
Add allow_cash_settlement toggle for fiat cash settlements.
"""
await db.execute(
"""
await db.execute("""
ALTER TABLE tpos.pos ADD allow_cash_settlement BOOLEAN DEFAULT false;
"""
)
""")
Loading