From f485f03f0c5f9e7147d98a845835fa87af07a7f7 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Thu, 23 Jun 2016 08:32:55 -0600 Subject: [PATCH] Add the account ID to the ofxaccount table This is how we'll store the account ID we need to send to the institution to identify the account we want to pull records from --- .../4b8ce290f890_ofxaccount_account_id.py | 28 +++++++++++++++++++ vanth/tables.py | 14 ++++++---- 2 files changed, 36 insertions(+), 6 deletions(-) create mode 100644 alembic/versions/4b8ce290f890_ofxaccount_account_id.py diff --git a/alembic/versions/4b8ce290f890_ofxaccount_account_id.py b/alembic/versions/4b8ce290f890_ofxaccount_account_id.py new file mode 100644 index 0000000..ee1969d --- /dev/null +++ b/alembic/versions/4b8ce290f890_ofxaccount_account_id.py @@ -0,0 +1,28 @@ +"""ofxaccount account_id + +Revision ID: 4b8ce290f890 +Revises: 2d295ac0fc07 +Create Date: 2016-06-23 08:32:42.429402 + +""" + +# revision identifiers, used by Alembic. +revision = '4b8ce290f890' +down_revision = '2d295ac0fc07' +branch_labels = None +depends_on = None + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + ### commands auto generated by Alembic - please adjust! ### + op.add_column('ofxaccount', sa.Column('account_id', sa.String(length=255), nullable=False)) + ### end Alembic commands ### + + +def downgrade(): + ### commands auto generated by Alembic - please adjust! ### + op.drop_column('ofxaccount', 'account_id') + ### end Alembic commands ### diff --git a/vanth/tables.py b/vanth/tables.py index 1a4c3dc..34db0ca 100644 --- a/vanth/tables.py +++ b/vanth/tables.py @@ -45,15 +45,17 @@ OFXSource = Table('ofxsource', metadata, ) OFXAccount = Table('ofxaccount', metadata, - Column('uuid', UUID(as_uuid=True), primary_key=True), + Column('account_id', String(255), nullable=False), # 123456-0.9:CHK Column('name', String(255), nullable=False), # My checking account - Column('user_id', String(255), nullable=False), # The user ID for the bank - Column('password', String(255), nullable=False), # The encrypted password for the account - Column('type', String(255), nullable=False), # The account type, like 'checking' - Column('source', None, ForeignKey(OFXSource.c.uuid, name='fk_ofxsource'), nullable=False), Column('owner', None, ForeignKey(User.c.uuid, name='fk_user'), nullable=False), + Column('password', String(255), nullable=False), # The encrypted password for the account + Column('source', None, ForeignKey(OFXSource.c.uuid, name='fk_ofxsource'), nullable=False), + 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('uuid', UUID(as_uuid=True), primary_key=True), + Column('created', DateTime(), nullable=False, server_default=func.now()), - Column('updated', DateTime(), nullable=False, server_default=func.now(), onupdate=func.now()), + Column('updated', DateTime(), nullable=False, server_default=func.now(), onupdate=func.now()), ) OFXRecord = Table('ofxrecord', metadata,