Update database.py
Browse files- 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/
|
| 10 |
-
return '/home/
|
| 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
|
| 34 |
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
| 35 |
-
|
| 36 |
)
|
| 37 |
''')
|
| 38 |
|
| 39 |
-
cursor.execute('SELECT COUNT(*) FROM
|
| 40 |
if cursor.fetchone()[0] == 0:
|
| 41 |
-
cursor.executemany('INSERT INTO udids (
|
| 42 |
-
[('
|
| 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()
|