yusufgundogdu commited on
Commit
3c7be5f
·
verified ·
1 Parent(s): 4bf0994

Update database.py

Browse files
Files changed (1) hide show
  1. database.py +9 -5
database.py CHANGED
@@ -1,3 +1,5 @@
 
 
1
  import sqlite3
2
  import os
3
  from flask import g
@@ -31,7 +33,8 @@ def init_db(app):
31
  CREATE TABLE IF NOT EXISTS users (
32
  id INTEGER PRIMARY KEY AUTOINCREMENT,
33
  udid TEXT NOT NULL UNIQUE,
34
- paid BOOLEAN DEFAULT FALSE,
 
35
  usage_limit INTEGER DEFAULT 4,
36
  invoice TEXT DEFAULT NULL
37
  )
@@ -39,8 +42,9 @@ def init_db(app):
39
 
40
  cursor.execute('SELECT COUNT(*) FROM users')
41
  if cursor.fetchone()[0] == 0:
42
- cursor.executemany('INSERT INTO users (udid, paid, usage_limit, invoice) VALUES (?, ?, ?, ?)',
43
- [('test_udid_1', True, 4, 'test_invoice_1'),
44
- ('test_udid_2', False, 4, None)])
45
 
46
- db.commit()
 
 
1
+ [file name]: database.py
2
+ [file content begin]
3
  import sqlite3
4
  import os
5
  from flask import g
 
33
  CREATE TABLE IF NOT EXISTS users (
34
  id INTEGER PRIMARY KEY AUTOINCREMENT,
35
  udid TEXT NOT NULL UNIQUE,
36
+ name TEXT DEFAULT NULL,
37
+ premiumAccount BOOLEAN DEFAULT FALSE,
38
  usage_limit INTEGER DEFAULT 4,
39
  invoice TEXT DEFAULT NULL
40
  )
 
42
 
43
  cursor.execute('SELECT COUNT(*) FROM users')
44
  if cursor.fetchone()[0] == 0:
45
+ cursor.executemany('INSERT INTO users (udid, name, premiumAccount, usage_limit, invoice) VALUES (?, ?, ?, ?, ?)',
46
+ [('test_udid_1', 'Test User 1', True, 4, 'test_invoice_1'),
47
+ ('test_udid_2', 'Test User 2', False, 4, None)])
48
 
49
+ db.commit()
50
+ [file content end]