Merge pull request #345 from waketzheng/dev

Drop python3.7 support
This commit is contained in:
long2ice
2024-06-06 15:49:31 +08:00
committed by GitHub
6 changed files with 505 additions and 633 deletions

View File

@@ -66,11 +66,11 @@ class BaseDDL:
forward_type=db_field_types.get(self.DIALECT) or db_field_types.get(""),
on_delete=field_describe.get("on_delete"),
extra=self.schema_generator._table_generate_extra(table=through),
comment=self.schema_generator._table_comment_generator(
table=through, comment=description
)
if description
else "",
comment=(
self.schema_generator._table_comment_generator(table=through, comment=description)
if description
else ""
),
)
def drop_m2m(self, table_name: str):
@@ -121,13 +121,15 @@ class BaseDDL:
field_type=db_field_types.get(self.DIALECT, db_field_types.get("")),
nullable="NOT NULL" if not field_describe.get("nullable") else "",
unique="UNIQUE" if field_describe.get("unique") else "",
comment=self.schema_generator._column_comment_generator(
table=db_table,
column=db_column,
comment=field_describe.get("description"),
)
if description
else "",
comment=(
self.schema_generator._column_comment_generator(
table=db_table,
column=db_column,
comment=field_describe.get("description"),
)
if description
else ""
),
is_primary_key=is_pk,
default=default,
),
@@ -151,13 +153,15 @@ class BaseDDL:
field_type=db_field_types.get(self.DIALECT) or db_field_types.get(""),
nullable="NOT NULL" if not field_describe.get("nullable") else "",
unique="",
comment=self.schema_generator._column_comment_generator(
table=db_table,
column=field_describe.get("db_column"),
comment=field_describe.get("description"),
)
if field_describe.get("description")
else "",
comment=(
self.schema_generator._column_comment_generator(
table=db_table,
column=field_describe.get("db_column"),
comment=field_describe.get("description"),
)
if field_describe.get("description")
else ""
),
is_primary_key=is_pk,
default=default,
),

View File

@@ -43,7 +43,9 @@ class PostgresDDL(BaseDDL):
return self._SET_COMMENT_TEMPLATE.format(
table_name=db_table,
column=field_describe.get("db_column") or field_describe.get("raw_field"),
comment="'{}'".format(field_describe.get("description"))
if field_describe.get("description")
else "NULL",
comment=(
"'{}'".format(field_describe.get("description"))
if field_describe.get("description")
else "NULL"
),
)