fix: decimal field change (#246)
This commit is contained in:
@@ -8,9 +8,9 @@ from tortoise.transactions import in_transaction
|
||||
from tortoise.utils import get_schema_sql
|
||||
|
||||
from aerich.exceptions import DowngradeError
|
||||
from aerich.inspect.mysql import InspectMySQL
|
||||
from aerich.inspect.postgres import InspectPostgres
|
||||
from aerich.inspect.sqlite import InspectSQLite
|
||||
from aerich.inspectdb.mysql import InspectMySQL
|
||||
from aerich.inspectdb.postgres import InspectPostgres
|
||||
from aerich.inspectdb.sqlite import InspectSQLite
|
||||
from aerich.migrate import Migrate
|
||||
from aerich.models import Aerich
|
||||
from aerich.utils import (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import List
|
||||
|
||||
from aerich.inspect import Column, Inspect
|
||||
from aerich.inspectdb import Column, Inspect
|
||||
|
||||
|
||||
class InspectMySQL(Inspect):
|
||||
@@ -2,7 +2,7 @@ from typing import List, Optional
|
||||
|
||||
from tortoise import BaseDBAsyncClient
|
||||
|
||||
from aerich.inspect import Column, Inspect
|
||||
from aerich.inspectdb import Column, Inspect
|
||||
|
||||
|
||||
class InspectPostgres(Inspect):
|
||||
@@ -1,6 +1,6 @@
|
||||
from typing import List
|
||||
|
||||
from aerich.inspect import Column, Inspect
|
||||
from aerich.inspectdb import Column, Inspect
|
||||
|
||||
|
||||
class InspectSQLite(Inspect):
|
||||
@@ -422,8 +422,14 @@ class Migrate:
|
||||
cls._drop_index(model, (field_name,), unique), upgrade, True
|
||||
)
|
||||
elif option == "db_field_types.":
|
||||
# continue since repeated with others
|
||||
continue
|
||||
if new_data_field.get("field_type") == "DecimalField":
|
||||
# modify column
|
||||
cls._add_operator(
|
||||
cls._modify_field(model, new_data_field),
|
||||
upgrade,
|
||||
)
|
||||
else:
|
||||
continue
|
||||
elif option == "default":
|
||||
if not (
|
||||
is_default_function(old_new[0]) or is_default_function(old_new[1])
|
||||
|
||||
Reference in New Issue
Block a user