Skip to content

Commit

Permalink
Merge pull request #495 from Open-Earth-Foundation/ON-1795_fix_column…
Browse files Browse the repository at this point in the history
…_types_country_table

fix:column_types
  • Loading branch information
amanda-eames authored May 23, 2024
2 parents c2eeaf8 + d095205 commit 78b09ce
Showing 1 changed file with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""fix_column_type_activity_emissions
Revision ID: c360f7e67f44
Revises: 949c5b9cc18d
Create Date: 2024-05-22 08:21:13.727742
"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = 'c360f7e67f44'
down_revision: Union[str, None] = '949c5b9cc18d'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
op.alter_column('country_code', 'activity_value',
existing_type=sa.String(),
type_=sa.Float(),
postgresql_using='activity_value::double precision')
op.alter_column('country_code', 'emissions_value',
existing_type=sa.String(),
type_=sa.Float(),
postgresql_using='emissions_value::double precision')

def downgrade() -> None:
op.alter_column('country_code', 'activity_value',
existing_type=sa.Float(),
type_=sa.String(),
postgresql_using='activity_value::text')
op.alter_column('country_code', 'emissions_value',
existing_type=sa.Float(),
type_=sa.String(),
postgresql_using='emissions_value::text')

0 comments on commit 78b09ce

Please sign in to comment.