import sqlite3 def migrate(conn: sqlite3.Connection): columns = conn.execute("PRAGMA table_info(posts)") column_names = [col[1] for col in columns] if "reposted_id" not in column_names: _ = conn.execute(""" ALTER TABLE posts ADD COLUMN reposted_id INTEGER NULL REFERENCES posts(id) ON DELETE SET NULL """)