Browse Source

fix primary-key integrity in db

thezero 3 years ago
parent
commit
2483a9434d
2 changed files with 2 additions and 3 deletions
  1. 2 2
      db.py
  2. 0 1
      vvvvget.py

+ 2 - 2
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()
 

+ 0 - 1
vvvvget.py

@@ -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