Les codes de département peuvent avoir 3 caractères
This commit is contained in:
parent
eed4dc18fb
commit
d6ed4eed17
|
@ -52,7 +52,7 @@ def upgrade() -> None:
|
||||||
sa.PrimaryKeyConstraint('id')
|
sa.PrimaryKeyConstraint('id')
|
||||||
)
|
)
|
||||||
op.create_table('departement',
|
op.create_table('departement',
|
||||||
sa.Column('code_insee', sa.String(length=2), nullable=False),
|
sa.Column('code_insee', sa.String(length=3), nullable=False),
|
||||||
sa.Column('libelle', sa.String(length=64), nullable=False),
|
sa.Column('libelle', sa.String(length=64), nullable=False),
|
||||||
sa.Column('region_code', sa.String(length=3), nullable=False),
|
sa.Column('region_code', sa.String(length=3), nullable=False),
|
||||||
sa.Column('geometry', sa.JSON(), nullable=False),
|
sa.Column('geometry', sa.JSON(), nullable=False),
|
||||||
|
@ -112,7 +112,7 @@ def upgrade() -> None:
|
||||||
op.create_table('commune',
|
op.create_table('commune',
|
||||||
sa.Column('code_insee', sa.String(length=5), nullable=False),
|
sa.Column('code_insee', sa.String(length=5), nullable=False),
|
||||||
sa.Column('libelle', sa.String(length=64), nullable=False),
|
sa.Column('libelle', sa.String(length=64), nullable=False),
|
||||||
sa.Column('departement_code', sa.String(length=2), nullable=False),
|
sa.Column('departement_code', sa.String(length=3), nullable=False),
|
||||||
sa.Column('geometry', sa.JSON(), nullable=False),
|
sa.Column('geometry', sa.JSON(), nullable=False),
|
||||||
sa.ForeignKeyConstraint(['departement_code'], ['departement.code_insee'], ),
|
sa.ForeignKeyConstraint(['departement_code'], ['departement.code_insee'], ),
|
||||||
sa.PrimaryKeyConstraint('code_insee')
|
sa.PrimaryKeyConstraint('code_insee')
|
||||||
|
|
|
@ -21,7 +21,7 @@ class Region(Base):
|
||||||
class Departement(Base):
|
class Departement(Base):
|
||||||
__tablename__ = "departement"
|
__tablename__ = "departement"
|
||||||
|
|
||||||
code_insee: Mapped[str] = mapped_column(String(2), primary_key=True)
|
code_insee: Mapped[str] = mapped_column(String(3), primary_key=True)
|
||||||
libelle: Mapped[str] = mapped_column(String(64), unique=True)
|
libelle: Mapped[str] = mapped_column(String(64), unique=True)
|
||||||
region_code: Mapped[int] = mapped_column(ForeignKey("region.code_insee"))
|
region_code: Mapped[int] = mapped_column(ForeignKey("region.code_insee"))
|
||||||
geometry: Mapped[dict] = mapped_column(JSON())
|
geometry: Mapped[dict] = mapped_column(JSON())
|
||||||
|
|
Loading…
Reference in New Issue