Remove system dependency on libsqlite3.so on command.upgrade (#413)

* Remove system dependency on libsqlite3.so on command.upgrade

* Fix styling using `make style` command
This commit is contained in:
alistairmaclean 2025-02-07 13:09:04 +01:00 committed by GitHub
parent d6b35ab0ac
commit 0be5c1b545
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,7 +5,6 @@ from typing import Any, List, Type, cast
import tortoise import tortoise
from tortoise import BaseDBAsyncClient, Model from tortoise import BaseDBAsyncClient, Model
from tortoise.backends.base.schema_generator import BaseSchemaGenerator from tortoise.backends.base.schema_generator import BaseSchemaGenerator
from tortoise.backends.sqlite.schema_generator import SqliteSchemaGenerator
from aerich.utils import is_default_function from aerich.utils import is_default_function
@ -128,11 +127,7 @@ class BaseDDL:
template = self._MODIFY_COLUMN_TEMPLATE template = self._MODIFY_COLUMN_TEMPLATE
else: else:
# sqlite does not support alter table to add unique column # sqlite does not support alter table to add unique column
unique = ( unique = " UNIQUE" if field_describe.get("unique") and self.DIALECT != "sqlite" else ""
" UNIQUE"
if field_describe.get("unique") and self.DIALECT != SqliteSchemaGenerator.DIALECT
else ""
)
template = self._ADD_COLUMN_TEMPLATE template = self._ADD_COLUMN_TEMPLATE
column = self.schema_generator._create_string( column = self.schema_generator._create_string(
db_column=db_column, db_column=db_column,