Created
June 10, 2019 20:30
-
-
Save metric-space/3849048b19175de35c4632be7bdf426b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import os.path | |
import sys | |
import datetime | |
project_clj = "project.clj" | |
migration_directory = "resources/migrations" | |
def important_check_for_project(): | |
return os.path.isfile("./"+ project_clj) and os.path.isdir("resources/migrations") and sys.argv[1] | |
if __name__ == '__main__': | |
if important_check_for_project(): | |
filename = datetime.datetime.utcnow().strftime("%Y%m%d%M%S") + "-" + sys.argv[1] | |
up = filename + ".up.sql" | |
down = filename + ".down.sql" | |
open(os.path.join(migration_directory,up),"w+") | |
open(os.path.join(migration_directory,down),"w+") | |
else: | |
sys.stderr.write("Not doing anything because I am not in a clojure project root") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment