Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When upgrading, find upgrade paths to current versions of tables even…
… if they're unchanged, so that other upgraders can depend on them. Add support for loading upgraders from a migrations directory. Return upgrade SQL separate from debug prints, for easier export
- Loading branch information
Showing
4 changed files
with
71 additions
and
31 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,22 @@ | |||
import sys, os, os.path | |||
|
|||
def find(dirpath): | |||
for dirname, dirnames, filenames in os.walk(dirpath): | |||
for filename in filenames: | |||
loader = fileLoaders.get(os.path.splitext(filename)[1]) | |||
if loader is not None: | |||
yield dirname, filename, loader | |||
|
|||
|
|||
def loadPython(dirname, filename): | |||
print "Importing", dirname, filename | |||
sys.path.insert(0, dirname) | |||
__import__(filename.rstrip(".py")) | |||
sys.path.pop(0) | |||
|
|||
|
|||
|
|||
fileLoaders = { | |||
'.py': loadPython, | |||
'.yaml': lambda x, y: None | |||
} |
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