yusufgundogdu commited on
Commit
546c0db
·
verified ·
1 Parent(s): e377ec9

Update database.py

Browse files
Files changed (1) hide show
  1. database.py +7 -7
database.py CHANGED
@@ -6,8 +6,8 @@ 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():
@@ -30,15 +30,15 @@ def init_db(app):
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()
 
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/udid_data'):
10
+ return '/home/udid_data/udids.db'
11
  return 'udids.db'
12
 
13
  def get_db():
 
30
  cursor = db.cursor()
31
 
32
  cursor.execute('''
33
+ CREATE TABLE IF NOT EXISTS udids (
34
  id INTEGER PRIMARY KEY AUTOINCREMENT,
35
+ name TEXT NOT NULL
36
  )
37
  ''')
38
 
39
+ cursor.execute('SELECT COUNT(*) FROM udids')
40
  if cursor.fetchone()[0] == 0:
41
+ cursor.executemany('INSERT INTO udids (name) VALUES (?)',
42
+ [('111'), ('222')])
43
 
44
  db.commit()