-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added ability for comma separated list filename patterns. #25
Conversation
I like the idea of having multiple patterns. I would prefer if it was using a Is there a reason why you deleted this PR? |
Weird. I didn't delete the PR. Or maybe I hit the wrong button. |
Not sure how to add a commit to this PR. Any hints on that? In the meantime, is this what you had in mind? Only problem I have with this is it is not backwards compatible. index 0251f37..9e08538 100644
--- a/tusker/__init__.py
+++ b/tusker/__init__.py
@@ -109,7 +109,7 @@ class Tusker:
with self.createdb('schema') as schema_engine:
with schema_engine.begin() as schema_cursor:
self.log('Creating original schema...')
- for pattern in self.config.schema.filename.split(","):
+ for pattern in self.config.schema.filename:
for filename in sorted(glob(pattern, recursive=True)):
self.log('- {}'.format(filename))
execute_sql_file(schema_cursor, filename)
diff --git a/tusker/config.py b/tusker/config.py
index 2dc1c4d..ff929a8 100644
--- a/tusker/config.py
+++ b/tusker/config.py
@@ -16,7 +16,7 @@ class Config:
data = {}
# time to validate some configuration variables
data.setdefault('database', {'dbname': 'tusker'})
- data.setdefault('schema', {'filename': 'schema.sql'})
+ data.setdefault('schema', {'filename': ['schema.sql']})
data.setdefault('migrations', {'directory': 'migrations'})
data.setdefault('migra', {'safe': False, 'privileges': False})
self.schema = SchemaConfig(data['schema'])
@@ -55,7 +55,7 @@ class SchemaConfig:
def __init__(self, data):
data = ConfigReader(data, 'schema')
- self.filename = data.get('filename', str) or 'schema.sql'
+ self.filename = data.get('filename', list) or ['schema.sql']
def __str__(self):
return 'SchemaConfig({!r})'.format(self.__dict__) |
You can just add commits to your branch. It will automatically added to the PR. A PR is in essence just a "please merge my branch" request. So if you change the branch the PR changes as well. Regarding the Implementation you could just add a |
Doesn't seem to have worked. I've done this from branch to branch but never from a fork. Could that be an issue? I may close this PR and create another one. |
This PR adds the ability to specify a comma separate list of glob patterns for the schema.filename configuration. Single pattern still works fine.
Example: