Update ofxrecord amount to valid monetary numeric type

We don't want no floats around here, this is money. This stuff matters.

I also took the time to align up my comments so they are purtier
This commit is contained in:
Eli Ribble 2016-07-01 11:59:46 -06:00
parent d479ca3850
commit 459a1b2960
2 changed files with 34 additions and 7 deletions

View file

@ -0,0 +1,27 @@
"""fix currency type
Revision ID: eac3a08698a7
Revises: 00f2b77f1d2c
Create Date: 2016-07-01 11:54:56.272364
"""
# revision identifiers, used by Alembic.
revision = 'eac3a08698a7'
down_revision = '00f2b77f1d2c'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
def upgrade():
if not op.get_context().as_sql:
connection = op.get_bind()
connection.execution_options(isolation_level='AUTOCOMMIT')
op.execute('ALTER TABLE ofxrecord ALTER COLUMN amount TYPE NUMERIC(20, 2) USING amount::numeric;')
def downgrade():
pass