fix primary-key integrity in db

This commit is contained in:
thezero 2018-10-29 23:17:37 +01:00
parent c57dbf881d
commit 2483a9434d
2 changed files with 2 additions and 3 deletions

4
db.py
View File

@ -10,8 +10,8 @@ class VVVVIDatabase():
def create(self):
con = sqlite3.connect(self.path)
cur = con.cursor()
cur.execute("CREATE TABLE series (id INTEGER, name TEXT NOT NULL, season_id INTEGER, type TEXT, PRIMARY KEY (id, season_id));")
cur.execute("CREATE TABLE episodes (id INTEGER, serie_id INTEGER, season_id INTEGER, cdn_url TEXT NOT NULL, type TEXT NOT NULL);")
cur.execute("CREATE TABLE series (id INTEGER NOT NULL, name TEXT NOT NULL, season_id INTEGER NOT NULL, type TEXT NOT NULL, PRIMARY KEY (id, season_id));")
cur.execute("CREATE TABLE episodes (id INTEGER NOT NULL, serie_id INTEGER NOT NULL, season_id INTEGER NOT NULL, cdn_url TEXT NOT NULL, type TEXT NOT NULL, PRIMARY KEY (id, serie_id, season_id, cdn_url, type));")
con.commit()
con.close()

View File

@ -55,7 +55,6 @@ for i in range(last, last + smax):
for j in seasons:
print("Found: {}".format(info['title']))
print(j)
if not vvvvidb.insert_serie((info['show_id'], info['title'], j['season_id'], j.get('name'))):
print("Serie already present")
continue