Let's say my schemas.py
looks like these:
class EimBase(SQLModel):
fimno: Optional[str]
spv_component_id: Optional[int]
eim_technology_name: Optional[str]
eim_technology_version: Optional[str]
obsolete_start_date: Optional[date]
actual_remediation_date: Optional[date]
intended_remediation_date: Optional[date]
issuestatus: Optional[str]
current_manu_phase: Optional[str]
current_manu_phase_start: Optional[date]
current_manu_phase_end: Optional[date]
remediation_type: Optional[str]
issue_component_id: Optional[str]
middleware_instance_name: Optional[str]
class Eim(EimBase,table=True):
id: Optional[int] = Field(default=None,primary_key=True)
spv_component_id: Optional[int] = Field(default=None,index=True)
When the database creates the table it will create like that in Postgres:
CREATE TABLE stage_eim (
fimno VARCHAR,
spv_component_id INTEGER,
eim_technology_name VARCHAR,
eim_technology_version VARCHAR,
obsolete_start_date DATE,
actual_remediation_date DATE,
intended_remediation_date DATE,
issuestatus VARCHAR,
current_manu_phase VARCHAR,
current_manu_phase_start DATE,
current_manu_phase_end DATE,
remediation_type VARCHAR,
issue_component_id VARCHAR,
middleware_instance_name VARCHAR,
id SERIAL NOT NULL,
PRIMARY KEY (id)
)
As you can see the id has the last position. I want the id to be the first position:
CREATE TABLE stage_eim (
id SERIAL NOT NULL,
....
)
How can I achieve that while keeping my schemas with the same structure ? If I define Eim
on top of EimBase
it will complain about spv_component_id