diff options
author | emkael <emkael@tlen.pl> | 2016-02-24 23:10:17 +0100 |
---|---|---|
committer | emkael <emkael@tlen.pl> | 2016-02-24 23:10:17 +0100 |
commit | 700580aaab62c9ef63df627522340507351a1f91 (patch) | |
tree | 7695d899f646c3dab57a51a2cdc0d22a6529639a /bin/init_db.py | |
parent | b62db16fc17eae80f4b2e69aac0e47af271129c6 (diff) |
* moing python scripts to subdirectory
Diffstat (limited to 'bin/init_db.py')
-rw-r--r-- | bin/init_db.py | 16 |
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() |