summaryrefslogtreecommitdiff
path: root/bin/init_db.py
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2016-02-24 23:10:17 +0100
committeremkael <emkael@tlen.pl>2016-02-24 23:10:17 +0100
commit700580aaab62c9ef63df627522340507351a1f91 (patch)
tree7695d899f646c3dab57a51a2cdc0d22a6529639a /bin/init_db.py
parentb62db16fc17eae80f4b2e69aac0e47af271129c6 (diff)
* moing python scripts to subdirectory
Diffstat (limited to 'bin/init_db.py')
-rw-r--r--bin/init_db.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/init_db.py b/bin/init_db.py
new file mode 100644
index 0000000..7d48e80
--- /dev/null
+++ b/bin/init_db.py
@@ -0,0 +1,16 @@
+import sys
+
+from rcal.db import Session
+from rcal.model import BASE
+
+
+def main():
+ session = Session.create()
+
+ if len(sys.argv) > 1 and sys.argv[1] == 'force':
+ BASE.metadata.drop_all(session.get_bind())
+
+ BASE.metadata.create_all(session.get_bind())
+
+if __name__ == '__main__':
+ main()