Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix #29 accepting a dash on migration filename

  • Loading branch information...
commit 08c311b97de427c3603712b16dc594097cfcbd3d 1 parent 67d6462
@wandenberg wandenberg authored
Showing with 6 additions and 1 deletion.
  1. +1 −1  simple_db_migrate/core/__init__.py
  2. +5 −0 tests/core_test.py
View
2  simple_db_migrate/core/__init__.py
@@ -11,7 +11,7 @@
class Migration(object):
MIGRATION_FILES_EXTENSION = ".migration"
- MIGRATION_FILES_MASK = r"[0-9]{14}_\w+%s$" % MIGRATION_FILES_EXTENSION
+ MIGRATION_FILES_MASK = r"[0-9]{14}_[\w\-]+%s$" % MIGRATION_FILES_EXTENSION
TEMPLATE = '#-*- coding:%s -*-\nSQL_UP = u"""\n\n"""\n\nSQL_DOWN = u"""\n\n"""\n'
def __init__(self, file=None, id=0, file_name="", version="", label=None, sql_up="", sql_down="", script_encoding="utf-8"):
View
5 tests/core_test.py
@@ -154,6 +154,7 @@ def test_it_should_use_get_all_migrations_versions_method_to_get_migration_from_
class MigrationTest(BaseTest):
def setUp(self):
create_migration_file('20090214120600_example_file_name_test_migration.migration', sql_up='xxx', sql_down='yyy')
+ create_migration_file('20090214121600_example_file_name_with_dash-test_migration.migration', sql_up='xxx', sql_down='yyy')
create_migration_file('20090727104700_test_migration.migration', sql_up='xxx', sql_down='yyy')
create_migration_file('20090727141400_test_migration.migration', sql_up='xxx', sql_down='yyy')
create_migration_file('20090727141503_test_migration.migration', sql_up='xxx', sql_down='yyy')
@@ -172,6 +173,10 @@ def test_it_should_get_migration_version_from_file(self):
migration = Migration('20090214120600_example_file_name_test_migration.migration')
self.assertEqual('20090214120600', migration.version)
+ def test_it_should_accept_a_dash_on_migration_file(self):
+ migration = Migration('20090214121600_example_file_name_with_dash-test_migration.migration')
+ self.assertEqual('20090214121600', migration.version)
+
def test_it_should_get_basic_properties_when_path_is_relative1(self):
migration = Migration(file='20090727104700_test_migration.migration')
self.assertEqual('20090727104700', migration.version)
Please sign in to comment.
Something went wrong with that request. Please try again.