yusufgundogdu commited on
Commit
dd8f68d
·
verified ·
1 Parent(s): 14551ef

Update database.py

Browse files
Files changed (1) hide show
  1. database.py +9 -10
database.py CHANGED
@@ -5,10 +5,10 @@ from flask import g
5
  def get_db_path():
6
  # Hugging Face Spaces için özel yol kontrolü
7
  if os.path.exists('/data'):
8
- return '/data/users.db'
9
- elif os.path.exists('/home/user_data'):
10
- return '/home/user_data/users.db'
11
- return 'users.db'
12
 
13
  def get_db():
14
  if 'db' not in g:
@@ -30,16 +30,15 @@ def init_db(app):
30
  cursor = db.cursor()
31
 
32
  cursor.execute('''
33
- CREATE TABLE IF NOT EXISTS users (
34
  id INTEGER PRIMARY KEY AUTOINCREMENT,
35
- name TEXT NOT NULL,
36
- score INTEGER DEFAULT 0
37
  )
38
  ''')
39
 
40
- cursor.execute('SELECT COUNT(*) FROM users')
41
  if cursor.fetchone()[0] == 0:
42
- cursor.executemany('INSERT INTO users (name, score) VALUES (?, ?)',
43
- [('Ahmet', 85), ('Mehmet', 92)])
44
 
45
  db.commit()
 
5
  def get_db_path():
6
  # Hugging Face Spaces için özel yol kontrolü
7
  if os.path.exists('/data'):
8
+ return '/data/udids.db'
9
+ elif os.path.exists('/home/udids_data'):
10
+ return '/home/udids_data/udids.db'
11
+ return 'udids.db'
12
 
13
  def get_db():
14
  if 'db' not in g:
 
30
  cursor = db.cursor()
31
 
32
  cursor.execute('''
33
+ CREATE TABLE IF NOT EXISTS udid (
34
  id INTEGER PRIMARY KEY AUTOINCREMENT,
35
+ udid TEXT NOT NULL
 
36
  )
37
  ''')
38
 
39
+ cursor.execute('SELECT COUNT(*) FROM udid')
40
  if cursor.fetchone()[0] == 0:
41
+ cursor.executemany('INSERT INTO udids (udid) VALUES (?, ?)',
42
+ [('1111'), ('2222'), ('3333'), ('4444'), ('5555')])
43
 
44
  db.commit()