diff options
| author | Jocelyn Delande <jocelyn@crapouillou.net> | 2016-05-21 23:47:12 +0200 |
|---|---|---|
| committer | Jocelyn Delande <jocelyn@crapouillou.net> | 2016-05-31 12:10:53 +0200 |
| commit | 74995f99595d30b6b3383d3761cbd730b3cb7798 (patch) | |
| tree | f386dd81ea074bb8a067c362d3df90aab4aed944 /budget/migrations/versions/b9a10d5d63ce_.py | |
| parent | 698efd7681d3d9fa6f621046a4dc95e0edc36a55 (diff) | |
| download | ihatemoney-mirror-74995f99595d30b6b3383d3761cbd730b3cb7798.zip ihatemoney-mirror-74995f99595d30b6b3383d3761cbd730b3cb7798.tar.gz ihatemoney-mirror-74995f99595d30b6b3383d3761cbd730b3cb7798.tar.bz2 | |
Handle migrations through alembic/flask-Migrations
Auto-initialization now applies migrations instead of using db. create_all()
fix #83
Diffstat (limited to 'budget/migrations/versions/b9a10d5d63ce_.py')
| -rw-r--r-- | budget/migrations/versions/b9a10d5d63ce_.py | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/budget/migrations/versions/b9a10d5d63ce_.py b/budget/migrations/versions/b9a10d5d63ce_.py new file mode 100644 index 0000000..92bb446 --- /dev/null +++ b/budget/migrations/versions/b9a10d5d63ce_.py @@ -0,0 +1,68 @@ +"""Initial migration + +Revision ID: b9a10d5d63ce +Revises: None +Create Date: 2016-05-21 23:21:21.605076 + +""" + +# revision identifiers, used by Alembic. +revision = 'b9a10d5d63ce' +down_revision = None + +from alembic import op +import sqlalchemy as sa + + +def upgrade(): + ### commands auto generated by Alembic - please adjust! ### + op.create_table('project', + sa.Column('id', sa.String(length=64), nullable=False), + sa.Column('name', sa.UnicodeText(), nullable=True), + sa.Column('password', sa.String(length=128), nullable=True), + sa.Column('contact_email', sa.String(length=128), nullable=True), + sa.PrimaryKeyConstraint('id') + ) + op.create_table('archive', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('project_id', sa.String(length=64), nullable=True), + sa.Column('name', sa.UnicodeText(), nullable=True), + sa.ForeignKeyConstraint(['project_id'], ['project.id'], ), + sa.PrimaryKeyConstraint('id') + ) + op.create_table('person', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('project_id', sa.String(length=64), nullable=True), + sa.Column('name', sa.UnicodeText(), nullable=True), + sa.Column('activated', sa.Boolean(), nullable=True), + sa.ForeignKeyConstraint(['project_id'], ['project.id'], ), + sa.PrimaryKeyConstraint('id') + ) + op.create_table('bill', + sa.Column('id', sa.Integer(), nullable=False), + sa.Column('payer_id', sa.Integer(), nullable=True), + sa.Column('amount', sa.Float(), nullable=True), + sa.Column('date', sa.Date(), nullable=True), + sa.Column('what', sa.UnicodeText(), nullable=True), + sa.Column('archive', sa.Integer(), nullable=True), + sa.ForeignKeyConstraint(['archive'], ['archive.id'], ), + sa.ForeignKeyConstraint(['payer_id'], ['person.id'], ), + sa.PrimaryKeyConstraint('id') + ) + op.create_table('billowers', + sa.Column('bill_id', sa.Integer(), nullable=True), + sa.Column('person_id', sa.Integer(), nullable=True), + sa.ForeignKeyConstraint(['bill_id'], ['bill.id'], ), + sa.ForeignKeyConstraint(['person_id'], ['person.id'], ) + ) + ### end Alembic commands ### + + +def downgrade(): + ### commands auto generated by Alembic - please adjust! ### + op.drop_table('billowers') + op.drop_table('bill') + op.drop_table('person') + op.drop_table('archive') + op.drop_table('project') + ### end Alembic commands ### |
