-- 创建供应商收款信息表
CREATE TABLE IF NOT EXISTS supplier_payment_infos (
  id INTEGER PRIMARY KEY AUTOINCREMENT,
  supplier_id INTEGER NOT NULL,
  account_name TEXT NOT NULL,
  bank_account TEXT NOT NULL,
  bank_name TEXT NOT NULL,
  qr_code TEXT,
  is_primary INTEGER DEFAULT 0,
  created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
  updated_at DATETIME DEFAULT CURRENT_TIMESTAMP,
  FOREIGN KEY (supplier_id) REFERENCES suppliers(id) ON DELETE CASCADE
);

-- 创建索引
CREATE INDEX IF NOT EXISTS idx_supplier_payment_infos_supplier_id ON supplier_payment_infos(supplier_id);
CREATE INDEX IF NOT EXISTS idx_supplier_payment_infos_is_primary ON supplier_payment_infos(is_primary);