this works better

This commit is contained in:
Viet Than 2023-09-07 22:37:11 -04:00
parent fdafa207ed
commit 7f488f5308

View file

@ -40,10 +40,10 @@ def downgrade():
""" """
Downgrade will truncate the milliseconds. Downgrade will truncate the milliseconds.
""" """
op.add_column(table_name, sa.Column('created_utc', sa.Integer(), server_default=sa.text('0'), nullable=True)) op.add_column(table_name, sa.Column(from_column, sa.Integer(), server_default=sa.text('0'), nullable=True))
op.execute(f""" op.execute(f"""
UPDATE {table_name} UPDATE {table_name}
SET created_utc = SET {from_column} =
COALESCE( COALESCE(
EXTRACT(EPOCH FROM {to_column})::integer, EXTRACT(EPOCH FROM {to_column})::integer,
0 0