Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. # -*- coding: UTF-8 -*-
  2. import os
  3.  
  4. path = os.getcwd()
  5.  
  6. def build_query(path):
  7. migration = '#Eeasy Migration Tool - Write all the querys \n'
  8. for path, subdirs, files in os.walk(path):
  9. for file in files:
  10. if file.endswith('.sql'):
  11. sql_file = os.path.join(path, file)
  12. migration += open(sql_file).read() + '\n'
  13. migration += '\n # Consider yourself migrated (⌐■_■)'
  14. return migration
  15.  
  16. try:
  17. migration = open('easy-migration.sql', 'w')
  18. migration.write(build_query(path))
  19. migration.close()
  20. print('ᕦ(ò_óˇ)ᕤ easy-migration.sql was created successfully')
  21. except:
  22. print('(>人<) Ooops, there\'s something wrong')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement