fix primary-key integrity in db
This commit is contained in:
parent
c57dbf881d
commit
2483a9434d
4
db.py
4
db.py
@ -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()
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user