Add table for tracking OFX updates

This is how we'll know when we queries via OFX for different accounts
and how we'll populate the table showing when we last updated an account
This commit is contained in:
Eli Ribble 2016-06-28 15:48:50 -06:00
parent f536f21d3c
commit 8a2f7bae70
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,32 @@
"""add ofxupdate
Revision ID: 00f2b77f1d2c
Revises: ab038e16ec9a
Create Date: 2016-06-28 15:48:14.994815
"""
# revision identifiers, used by Alembic.
revision = '00f2b77f1d2c'
down_revision = 'ab038e16ec9a'
branch_labels = None
depends_on = None
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
def upgrade():
op.create_table('ofxupdate',
sa.Column('uuid', postgresql.UUID(as_uuid=True), server_default=sa.text('gen_random_uuid()'), nullable=False),
sa.Column('created', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
sa.Column('updated', sa.DateTime(), server_default=sa.text('now()'), nullable=False),
sa.Column('deleted', sa.DateTime(), nullable=True),
sa.Column('ofxaccount', postgresql.UUID(as_uuid=True), nullable=False),
sa.ForeignKeyConstraint(['ofxaccount'], ['ofxaccount.uuid'], name='fk_ofxaccount'),
sa.PrimaryKeyConstraint('uuid', name=op.f('pk_ofxupdate'))
)
def downgrade():
op.drop_table('ofxupdate')

View File

@ -59,7 +59,10 @@ OFXAccount = table('ofxaccount',
Column('type', String(255), nullable=False), # The account type, like 'checking' Column('type', String(255), nullable=False), # The account type, like 'checking'
Column('user_id', String(255), nullable=False), # The user ID for the bank Column('user_id', String(255), nullable=False), # The user ID for the bank
Column('uuid', UUID(as_uuid=True), primary_key=True), Column('uuid', UUID(as_uuid=True), primary_key=True),
)
OFXUpdate = table('ofxupdate',
Column('ofxaccount', None, ForeignKey(OFXAccount.c.uuid, name='fk_ofxaccount'), nullable=False),
) )
OFXRecord = table('ofxrecord', OFXRecord = table('ofxrecord',