fix: text in numeric column

v0.4
rrr-marble 3 years ago
parent 20d59a61e2
commit 14616e8eb9

@ -10,21 +10,41 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '4968a333a100'
down_revision = 'b76b7f791b3b'
revision = "4968a333a100"
down_revision = "b76b7f791b3b"
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic ###
op.add_column('geodata', sa.Column('depth_min', sa.Float(), sa.Computed("SPLIT_PART(depth,'-',1)", ), nullable=True))
op.add_column('geodata', sa.Column('depth_max', sa.Float(), sa.Computed("SPLIT_PART(depth,'-',2)", ), nullable=True))
op.add_column(
"geodata",
sa.Column(
"depth_min",
sa.Float(),
sa.Computed(
"CAST(SPLIT_PART(depth,'-',1) AS DOUBLE PRECISION)",
),
nullable=True,
),
)
op.add_column(
"geodata",
sa.Column(
"depth_max",
sa.Float(),
sa.Computed(
"CAST(SPLIT_PART(depth,'-',1) AS DOUBLE PRECISION)",
),
nullable=True,
),
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic ###
op.drop_column('geodata', 'depth_max')
op.drop_column('geodata', 'depth_min')
op.drop_column("geodata", "depth_max")
op.drop_column("geodata", "depth_min")
# ### end Alembic commands ###

@ -48,8 +48,12 @@ class ItemCreate(ItemBase):
class Item(ItemBase):
depth_min = Column(Float, Computed("SPLIT_PART(depth,'-',1)"))
depth_max = Column(Float, Computed("SPLIT_PART(depth,'-',2)"))
depth_min = Column(
Float, Computed("CAST(SPLIT_PART(depth,'-',1) AS DOUBLE PRECISION)")
)
depth_max = Column(
Float, Computed("CAST(SPLIT_PART(depth,'-',2)) AS DOUBLE PRECISION")
)
geodata_search_ts = Column(
TSVECTOR,

Loading…
Cancel
Save