import sqlite3
c = sqlite3.connect('db.sqlite3')
cur = c.cursor()

# Create erp_account table
cur.execute("""
CREATE TABLE IF NOT EXISTS erp_account (
    id          VARCHAR(36) PRIMARY KEY,
    created_at  DATETIME NOT NULL,
    updated_at  DATETIME NOT NULL,
    tenant_id   VARCHAR(36) NOT NULL,
    code        VARCHAR(32) NOT NULL,
    name        VARCHAR(128) NOT NULL,
    type        VARCHAR(32) NOT NULL,
    currency    VARCHAR(3) NOT NULL DEFAULT 'PHP',
    is_active   INTEGER NOT NULL DEFAULT 1,
    UNIQUE (tenant_id, code)
)
""")
c.commit()
print("erp_account table created")

# Verify
cur.execute("SELECT name FROM sqlite_master WHERE type='table' AND name LIKE 'erp_%'")
print("ERP tables:", [r[0] for r in cur.fetchall()])
