diff --git a/aerich/inspect/__init__.py b/aerich/inspect/__init__.py index 25d7d24..ee7fd1b 100644 --- a/aerich/inspect/__init__.py +++ b/aerich/inspect/__init__.py @@ -30,8 +30,13 @@ class Column(BaseModel): index = "index=True, " if self.data_type in ["varchar", "VARCHAR"]: length = f"max_length={self.length}, " - if self.data_type == "decimal": - length = f"max_digits={self.max_digits}, decimal_places={self.decimal_places}, " + if self.data_type in ["decimal", "numeric"]: + length_parts = [] + if self.max_digits: + length_parts.append(f"max_digits={self.max_digits}") + if self.decimal_places: + length_parts.append(f"decimal_places={self.decimal_places}") + length = "".join(length_parts) if self.null: null = "null=True, " if self.default is not None: diff --git a/aerich/inspect/postgres.py b/aerich/inspect/postgres.py index a30b947..8327618 100644 --- a/aerich/inspect/postgres.py +++ b/aerich/inspect/postgres.py @@ -25,6 +25,7 @@ class InspectPostgres(Inspect): "date": self.date_field, "time": self.time_field, "decimal": self.decimal_field, + "numeric": self.decimal_field, "uuid": self.uuid_field, "jsonb": self.json_field, "bytea": self.binary_field,