Add IF NOT EXISTS for entry table creation

This commit is contained in:
Tulir Asokan 2022-03-28 17:25:08 +03:00
parent 7b609ebb24
commit b7e4a2a7bd

View File

@ -50,7 +50,7 @@ async def upgrade_latest(conn: Connection, scheme: Scheme) -> None:
)""" )"""
) )
await conn.execute( await conn.execute(
"""CREATE TABLE entry ( """CREATE TABLE IF NOT EXISTS entry (
feed_id INTEGER, feed_id INTEGER,
id TEXT, id TEXT,
date timestamp NOT NULL, date timestamp NOT NULL,
@ -59,7 +59,7 @@ async def upgrade_latest(conn: Connection, scheme: Scheme) -> None:
link TEXT NOT NULL, link TEXT NOT NULL,
PRIMARY KEY (feed_id, id), PRIMARY KEY (feed_id, id),
FOREIGN KEY (feed_id) REFERENCES feed (id) FOREIGN KEY (feed_id) REFERENCES feed (id)
);""" )"""
) )