chore: make style, upgrade deps, fix ci error and update changelog

This commit is contained in:
Waket Zheng
2024-11-25 23:46:48 +08:00
parent 095eb48196
commit dc020358b6
12 changed files with 496 additions and 434 deletions

View File

@@ -37,7 +37,9 @@ async def cli(ctx: Context, config, app) -> None:
if invoked_subcommand != "init":
config_path = Path(config)
if not config_path.exists():
raise UsageError("You need to run `aerich init` first to create the config file.", ctx=ctx)
raise UsageError(
"You need to run `aerich init` first to create the config file.", ctx=ctx
)
content = config_path.read_text()
doc: dict = tomlkit.parse(content)
try:
@@ -56,7 +58,9 @@ async def cli(ctx: Context, config, app) -> None:
ctx.obj["command"] = command
if invoked_subcommand != "init-db":
if not Path(location, app).exists():
raise UsageError("You need to run `aerich init-db` first to initialize the database.", ctx=ctx)
raise UsageError(
"You need to run `aerich init-db` first to initialize the database.", ctx=ctx
)
await command.init()

View File

@@ -192,7 +192,7 @@ class Migrate:
ret: list = []
def index_hash(self) -> str:
h = hashlib.new("MD5", usedforsecurity=False)
h = hashlib.new("MD5", usedforsecurity=False) # type:ignore[call-arg]
h.update(
self.index_name(cls.ddl.schema_generator, model).encode()
+ self.__class__.__name__.encode()

View File

@@ -9,7 +9,7 @@ MAX_APP_LENGTH = 100
class Aerich(Model):
version = fields.CharField(max_length=MAX_VERSION_LENGTH)
app = fields.CharField(max_length=MAX_APP_LENGTH)
content = fields.JSONField(encoder=encoder, decoder=decoder)
content: dict = fields.JSONField(encoder=encoder, decoder=decoder)
class Meta:
ordering = ["-id"]