-- 002_migration_history.sql — Track applied migrations.
-- Run manually: psql $DATABASE_URL -f migrations/002_migration_history.sql

CREATE TABLE IF NOT EXISTS migration_history (
    id SERIAL PRIMARY KEY,
    filename VARCHAR(255) UNIQUE NOT NULL,
    applied_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

-- Record this migration.
INSERT INTO migration_history (filename) VALUES ('002_migration_history.sql')
    ON CONFLICT (filename) DO NOTHING;
