Fix ci error

This commit is contained in:
long2ice 2020-11-19 10:41:52 +08:00
parent 9879004fee
commit a677d506a9
3 changed files with 9 additions and 3 deletions

View File

@ -6,7 +6,7 @@ MYSQL_PORT ?= 3306
MYSQL_PASS ?= "123456" MYSQL_PASS ?= "123456"
POSTGRES_HOST ?= "127.0.0.1" POSTGRES_HOST ?= "127.0.0.1"
POSTGRES_PORT ?= 5432 POSTGRES_PORT ?= 5432
POSTGRES_PAS ?= "123456" POSTGRES_PASS ?= "123456"
help: help:
@echo "Aerich development makefile" @echo "Aerich development makefile"

View File

@ -262,7 +262,9 @@ async def init_db(ctx: Context, safe):
os.mkdir(dirname) os.mkdir(dirname)
click.secho(f"Success create app migrate location {dirname}", fg=Color.green) click.secho(f"Success create app migrate location {dirname}", fg=Color.green)
else: else:
return click.secho(f"Inited {app} already", fg=Color.yellow) return click.secho(
f"Inited {app} already, or delete {dirname} and try again.", fg=Color.yellow
)
await Tortoise.init(config=config) await Tortoise.init(config=config)
connection = get_app_connection(config, app) connection = get_app_connection(config, app)

View File

@ -312,7 +312,11 @@ class Migrate:
else: else:
is_rename = diff_key in cls._rename_new is_rename = diff_key in cls._rename_new
if is_rename: if is_rename:
if cls.dialect == "mysql" and cls._db_version.major == 5: if (
cls.dialect == "mysql"
and cls._db_version
and cls._db_version.major == 5
):
cls._add_operator( cls._add_operator(
cls._change_field(new_model, old_field, new_field), cls._change_field(new_model, old_field, new_field),
upgrade, upgrade,