Pendrokar commited on
Commit
10bbab8
·
1 Parent(s): 84831a7

New DB fix

Browse files
Files changed (1) hide show
  1. app/db.py +6 -0
app/db.py CHANGED
@@ -48,7 +48,13 @@ def create_db():
48
  cursor.execute('''
49
  CREATE TABLE IF NOT EXISTS spokentext (
50
  id INTEGER PRIMARY KEY AUTOINCREMENT,
 
51
  spokentext TEXT,
 
52
  timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP
53
  );
 
 
 
 
54
  ''')
 
48
  cursor.execute('''
49
  CREATE TABLE IF NOT EXISTS spokentext (
50
  id INTEGER PRIMARY KEY AUTOINCREMENT,
51
+ votelog_id INTEGER UNIQUE,
52
  spokentext TEXT,
53
+ lang TEXT,
54
  timestamp TIMESTAMP DEFAULT CURRENT_TIMESTAMP
55
  );
56
+ ''')
57
+ # foreign keys
58
+ cursor.execute('''
59
+ CREATE UNIQUE INDEX IF NOT EXISTS st_to_vl ON spokentext(votelog_id);
60
  ''')