@@ -14,5 +14,8 @@ class Migration:
self.method(db)
def migration(method):
- version, name = module_name_regex.match(method.__module__).groups()
+ match = module_name_regex.match(method.__module__)
+ if not match:
+ raise Exception(f"Unable to find migration version in #{method.__module__}")
+ version, name = match.groups()
registered.append(Migration(version, name, method))
@@ -63,6 +63,10 @@ def ForeignKeyField(key: object, null: bool = None, backref: str = "") -> Any:
pass
+def IntegerField(default: int = 0, unique: bool = False, null: bool = None) -> Any:
+ pass
+
class IntegrityError(Exception):
@@ -0,0 +1,5 @@
+import typing
+class SqliteMigrator:
+ def __init__(self, db: typing.Any):