diff options
Diffstat (limited to 'ihatemoney/migrations/versions')
7 files changed, 94 insertions, 91 deletions
diff --git a/ihatemoney/migrations/versions/26d6a218c329_.py b/ihatemoney/migrations/versions/26d6a218c329_.py index 859b9af..6d5e237 100644 --- a/ihatemoney/migrations/versions/26d6a218c329_.py +++ b/ihatemoney/migrations/versions/26d6a218c329_.py @@ -7,8 +7,8 @@ Create Date: 2016-06-15 09:22:04.069447 """ # revision identifiers, used by Alembic. -revision = '26d6a218c329' -down_revision = 'b9a10d5d63ce' +revision = "26d6a218c329" +down_revision = "b9a10d5d63ce" from alembic import op import sqlalchemy as sa @@ -16,11 +16,11 @@ import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - please adjust! ### - op.add_column('person', sa.Column('weight', sa.Float(), nullable=True)) + op.add_column("person", sa.Column("weight", sa.Float(), nullable=True)) ### end Alembic commands ### def downgrade(): ### commands auto generated by Alembic - please adjust! ### - op.drop_column('person', 'weight') + op.drop_column("person", "weight") ### end Alembic commands ### diff --git a/ihatemoney/migrations/versions/6c6fb2b7f229_.py b/ihatemoney/migrations/versions/6c6fb2b7f229_.py index 0336f6c..da31578 100644 --- a/ihatemoney/migrations/versions/6c6fb2b7f229_.py +++ b/ihatemoney/migrations/versions/6c6fb2b7f229_.py @@ -7,8 +7,8 @@ Create Date: 2019-09-28 13:38:09.550747 """ # revision identifiers, used by Alembic. -revision = '6c6fb2b7f229' -down_revision = 'a67119aa3ee5' +revision = "6c6fb2b7f229" +down_revision = "a67119aa3ee5" from alembic import op import sqlalchemy as sa @@ -16,11 +16,11 @@ import sqlalchemy as sa def upgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.add_column('bill', sa.Column('external_link', sa.UnicodeText(), nullable=True)) + op.add_column("bill", sa.Column("external_link", sa.UnicodeText(), nullable=True)) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### - op.drop_column('bill', 'external_link') + op.drop_column("bill", "external_link") # ### end Alembic commands ### diff --git a/ihatemoney/migrations/versions/a67119aa3ee5_migrate_negative_weights.py b/ihatemoney/migrations/versions/a67119aa3ee5_migrate_negative_weights.py index ec23470..8061896 100644 --- a/ihatemoney/migrations/versions/a67119aa3ee5_migrate_negative_weights.py +++ b/ihatemoney/migrations/versions/a67119aa3ee5_migrate_negative_weights.py @@ -7,29 +7,29 @@ Create Date: 2018-12-25 18:34:20.220844 """ # revision identifiers, used by Alembic. -revision = 'a67119aa3ee5' -down_revision = 'afbf27e6ef20' +revision = "a67119aa3ee5" +down_revision = "afbf27e6ef20" from alembic import op import sqlalchemy as sa + # Snapshot of the person table person_helper = sa.Table( - 'person', sa.MetaData(), - 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.Column('weight', sa.Float(), nullable=True), - sa.ForeignKeyConstraint(['project_id'], ['project.id'], ), - sa.PrimaryKeyConstraint('id') + "person", + sa.MetaData(), + 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.Column("weight", sa.Float(), nullable=True), + sa.ForeignKeyConstraint(["project_id"], ["project.id"]), + sa.PrimaryKeyConstraint("id"), ) def upgrade(): op.execute( - person_helper.update() - .where(person_helper.c.weight <= 0) - .values(weight=1) + person_helper.update().where(person_helper.c.weight <= 0).values(weight=1) ) diff --git a/ihatemoney/migrations/versions/afbf27e6ef20_add_bill_import_date_field.py b/ihatemoney/migrations/versions/afbf27e6ef20_add_bill_import_date_field.py index 4179155..0ccfac2 100644 --- a/ihatemoney/migrations/versions/afbf27e6ef20_add_bill_import_date_field.py +++ b/ihatemoney/migrations/versions/afbf27e6ef20_add_bill_import_date_field.py @@ -7,8 +7,8 @@ Create Date: 2018-02-19 20:29:26.286136 """ # revision identifiers, used by Alembic. -revision = 'afbf27e6ef20' -down_revision = 'b78f8a8bdb16' +revision = "afbf27e6ef20" +down_revision = "b78f8a8bdb16" from alembic import op import sqlalchemy as sa @@ -16,11 +16,11 @@ import sqlalchemy as sa def upgrade(): ### commands auto generated by Alembic - please adjust! ### - op.add_column('bill', sa.Column('creation_date', sa.Date(), nullable=True)) + op.add_column("bill", sa.Column("creation_date", sa.Date(), nullable=True)) ### end Alembic commands ### def downgrade(): ### commands auto generated by Alembic - please adjust! ### - op.drop_column('bill', 'creation_date') + op.drop_column("bill", "creation_date") ### end Alembic commands ### diff --git a/ihatemoney/migrations/versions/b78f8a8bdb16_hash_project_passwords.py b/ihatemoney/migrations/versions/b78f8a8bdb16_hash_project_passwords.py index e32983d..e730b8d 100644 --- a/ihatemoney/migrations/versions/b78f8a8bdb16_hash_project_passwords.py +++ b/ihatemoney/migrations/versions/b78f8a8bdb16_hash_project_passwords.py @@ -7,20 +7,21 @@ Create Date: 2017-12-17 11:45:44.783238 """ # revision identifiers, used by Alembic. -revision = 'b78f8a8bdb16' -down_revision = 'f629c8ef4ab0' +revision = "b78f8a8bdb16" +down_revision = "f629c8ef4ab0" from alembic import op import sqlalchemy as sa from werkzeug.security import generate_password_hash project_helper = sa.Table( - 'project', sa.MetaData(), - 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') + "project", + sa.MetaData(), + 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"), ) @@ -28,11 +29,9 @@ def upgrade(): connection = op.get_bind() for project in connection.execute(project_helper.select()): connection.execute( - project_helper.update().where( - project_helper.c.name == project.name - ).values( - password=generate_password_hash(project.password) - ) + project_helper.update() + .where(project_helper.c.name == project.name) + .values(password=generate_password_hash(project.password)) ) diff --git a/ihatemoney/migrations/versions/b9a10d5d63ce_.py b/ihatemoney/migrations/versions/b9a10d5d63ce_.py index 92bb446..3c92780 100644 --- a/ihatemoney/migrations/versions/b9a10d5d63ce_.py +++ b/ihatemoney/migrations/versions/b9a10d5d63ce_.py @@ -7,7 +7,7 @@ Create Date: 2016-05-21 23:21:21.605076 """ # revision identifiers, used by Alembic. -revision = 'b9a10d5d63ce' +revision = "b9a10d5d63ce" down_revision = None from alembic import op @@ -16,53 +16,58 @@ 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( + "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( + "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( + "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( + "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'], ) + 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') + op.drop_table("billowers") + op.drop_table("bill") + op.drop_table("person") + op.drop_table("archive") + op.drop_table("project") ### end Alembic commands ### diff --git a/ihatemoney/migrations/versions/f629c8ef4ab0_initialize_all_members_weights_to_1.py b/ihatemoney/migrations/versions/f629c8ef4ab0_initialize_all_members_weights_to_1.py index 5542146..481c2d9 100644 --- a/ihatemoney/migrations/versions/f629c8ef4ab0_initialize_all_members_weights_to_1.py +++ b/ihatemoney/migrations/versions/f629c8ef4ab0_initialize_all_members_weights_to_1.py @@ -7,30 +7,29 @@ Create Date: 2016-06-15 09:40:30.400862 """ # revision identifiers, used by Alembic. -revision = 'f629c8ef4ab0' -down_revision = '26d6a218c329' +revision = "f629c8ef4ab0" +down_revision = "26d6a218c329" from alembic import op import sqlalchemy as sa # Snapshot of the person table person_helper = sa.Table( - 'person', sa.MetaData(), - 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.Column('weight', sa.Float(), nullable=True), - sa.ForeignKeyConstraint(['project_id'], ['project.id'], ), - sa.PrimaryKeyConstraint('id') + "person", + sa.MetaData(), + 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.Column("weight", sa.Float(), nullable=True), + sa.ForeignKeyConstraint(["project_id"], ["project.id"]), + sa.PrimaryKeyConstraint("id"), ) def upgrade(): op.execute( - person_helper.update() - .where(person_helper.c.weight == None) - .values(weight=1) + person_helper.update().where(person_helper.c.weight == None).values(weight=1) ) |
