Remove duplication
This commit is contained in:
1 parent
ff8e1b4363
commit
6fe51d2e08
4 files changed
+8
-6
No files matched your search
@@ -13,3 +13,4 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from .migration_linter import * # noqa
|
from .migration_linter import * # noqa
|
||||||
|
from .constants import * # noqa
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# Can be used to mark ignored migrations.
|
||||||
|
# This is a noop for SQL. Comments would be better.
|
||||||
|
# But comments are stripped by RunSQL
|
||||||
|
IGNORE_MIGRATION = ("SELECT 'dml-ignore'", )
|
||||||
@@ -24,11 +24,6 @@ from .sql_analyser import analyse_sql_statements
|
|||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
# Can be used to mark ignored migrations.
|
|
||||||
# This is a noop for SQL. Comments would be better.
|
|
||||||
# But comments are stripped by RunSQL
|
|
||||||
IGNORE_MIGRATION = ("SELECT 'dml-ignore'", )
|
|
||||||
|
|
||||||
|
|
||||||
class MigrationLinter(object):
|
class MigrationLinter(object):
|
||||||
MIGRATION_FOLDER_NAME = 'migrations'
|
MIGRATION_FOLDER_NAME = 'migrations'
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
import re
|
import re
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from django_migration_linter.constants import IGNORE_MIGRATION
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
@@ -65,7 +67,7 @@ migration_tests = (
|
|||||||
'err_msg': ''
|
'err_msg': ''
|
||||||
}, {
|
}, {
|
||||||
'code': 'IGNORED_MIGRATION',
|
'code': 'IGNORED_MIGRATION',
|
||||||
'fn': lambda sql, **kw: re.search('dml-ignore', sql),
|
'fn': lambda sql, **kw: re.search(IGNORE_MIGRATION[0], sql),
|
||||||
'err_msg': '',
|
'err_msg': '',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in new issue
Block a user