Skip to content

Commit

Permalink
Make some minor changes to field ordering for serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyMcCormick committed Feb 24, 2025
1 parent ec2c56a commit 672b2ba
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions python/felis/datamodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,6 @@ class Column(BaseObject):
autoincrement: bool | None = None
"""Whether the column is autoincremented."""

mysql_datatype: str | None = Field(None, alias="mysql:datatype")
"""MySQL datatype override on the column."""

postgresql_datatype: str | None = Field(None, alias="postgresql:datatype")
"""PostgreSQL datatype override on the column."""

ivoa_ucd: str | None = Field(None, alias="ivoa:ucd")
"""IVOA UCD of the column."""

Expand Down Expand Up @@ -230,6 +224,12 @@ class Column(BaseObject):
votable_datatype: str | None = Field(None, alias="votable:datatype")
"""VOTable datatype of the column."""

mysql_datatype: str | None = Field(None, alias="mysql:datatype")
"""MySQL datatype override on the column."""

postgresql_datatype: str | None = Field(None, alias="postgresql:datatype")
"""PostgreSQL datatype override on the column."""

@model_validator(mode="after")
def check_value(self) -> Column:
"""Check that the default value is valid.
Expand Down Expand Up @@ -681,18 +681,6 @@ def serialize_columns(self, columns: list[ColumnRef | Column]) -> list[str]:
class Table(BaseObject):
"""Table model."""

columns: Sequence[Column]
"""Columns in the table."""

constraints: list[_ConstraintType] = Field(default_factory=list)
"""Constraints on the table."""

indexes: list[Index] = Field(default_factory=list)
"""Indexes on the table."""

column_groups: list[ColumnGroup] = Field(default_factory=list, alias="columnGroups")
"""Column groups in the table."""

primary_key: str | list[str] | None = Field(None, alias="primaryKey")
"""Primary key of the table."""

Expand All @@ -705,6 +693,18 @@ class Table(BaseObject):
mysql_charset: str | None = Field(None, alias="mysql:charset")
"""MySQL charset to use for the table."""

columns: Sequence[Column]
"""Columns in the table."""

column_groups: list[ColumnGroup] = Field(default_factory=list, alias="columnGroups")
"""Column groups in the table."""

constraints: list[_ConstraintType] = Field(default_factory=list)
"""Constraints on the table."""

indexes: list[Index] = Field(default_factory=list)
"""Indexes on the table."""

@field_validator("columns", mode="after")
@classmethod
def check_unique_column_names(cls, columns: list[Column]) -> list[Column]:
Expand Down

0 comments on commit 672b2ba

Please sign in to comment.