import sqlite3
c = sqlite3.connect('db.sqlite3')
cur = c.cursor()
cur.execute("SELECT name FROM sqlite_master WHERE type='table' AND name LIKE 'erp_%'")
print("ERP tables:", [r[0] for r in cur.fetchall()])
cur.execute("SELECT app, name FROM django_migrations WHERE app='erp'")
print("ERP migrations:", list(cur.fetchall()))
cur.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='erp_shipment'")
print("erp_shipment exists:", cur.fetchone())
cur.execute("SELECT name FROM sqlite_master WHERE type='table' AND name='erp_account'")
print("erp_account exists:", cur.fetchone())
cur.execute("SELECT name FROM sqlite_master WHERE type='table'")
print("\nAll tables:", [r[0] for r in cur.fetchall()])
