summaryrefslogtreecommitdiff
path: root/database/rebuild-database.py
diff options
context:
space:
mode:
authorGeorgios Andreadis <info@gandreadis.com>2020-06-30 14:40:18 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2020-08-24 19:43:48 +0200
commit8ede2b8597eb14c0567c2c3c0135593f7c557521 (patch)
treeb54bb8f8fc6ba93bda3e3f127191bde96450c0ec /database/rebuild-database.py
parent4c8a21da65e9a02437c03dcdb8aab6b054b651b0 (diff)
Continue cleaning up
Diffstat (limited to 'database/rebuild-database.py')
-rw-r--r--database/rebuild-database.py32
1 files changed, 0 insertions, 32 deletions
diff --git a/database/rebuild-database.py b/database/rebuild-database.py
deleted file mode 100644
index 0cbeb27a..00000000
--- a/database/rebuild-database.py
+++ /dev/null
@@ -1,32 +0,0 @@
-import os
-import sqlite3
-import sys
-
-sys.stdout = os.fdopen(sys.stdout.fileno(), 'w', 0)
-
-try:
- BASE_DIR = directory_name=sys.argv[1]
-except:
- BASE_DIR = os.path.dirname(os.path.abspath(__file__))
-db_location = os.path.join(BASE_DIR, 'opendc.db')
-
-if os.path.exists(db_location):
- print "Removing old database..."
- os.remove(db_location)
-
-print "Connecting to new database..."
-conn = sqlite3.connect(db_location)
-c = conn.cursor()
-
-print "Importing schema..."
-with open('schema.sql') as schema:
- c.executescript(schema.read())
-
-print "Importing test data..."
-with open('test.sql') as test:
- c.executescript(test.read())
-
-conn.commit()
-conn.close()
-
-print "Done."