"""Add tier, logo, verified, highlight, and sticky columns to suppliers."""


def up(conn):
    existing = {
        row[1] for row in conn.execute("PRAGMA table_info(suppliers)").fetchall()
    }

    columns = [
        ("tier", "TEXT NOT NULL DEFAULT 'free'"),
        ("logo_url", "TEXT"),
        ("is_verified", "INTEGER NOT NULL DEFAULT 0"),
        ("highlight", "INTEGER NOT NULL DEFAULT 0"),
        ("sticky_until", "TEXT"),
        ("sticky_country", "TEXT"),
    ]

    for name, definition in columns:
        if name not in existing:
            conn.execute(f"ALTER TABLE suppliers ADD COLUMN {name} {definition}")
