Skip to content

Commit

Permalink
Fix alembic migrations
Browse files Browse the repository at this point in the history
* When using production database one revision was skipped. This was caused
by bad order of the revisions.

* Thanks to recent changes to alembic.ini one issue was found in ansible
script that tried to replace non-existing line in alembic.ini.

Fixes fedora-infra#819.

Signed-off-by: Michal Konečný <[email protected]>
  • Loading branch information
Zlopez authored and Zlopez committed Sep 2, 2019
1 parent e1e179b commit 1afe579
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Add release check to project
Revision ID: 5e209766aead
Revises: e34988f3e2f4
Revises: 708f6f26b4b6
Create Date: 2019-06-06 14:53:06.236820
"""

Expand All @@ -11,7 +11,7 @@

# revision identifiers, used by Alembic.
revision = "5e209766aead"
down_revision = "e34988f3e2f4"
down_revision = "708f6f26b4b6"


def upgrade():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Add version pattern
Revision ID: 708f6f26b4b6
Revises: 1ab95561edae
Revises: e34988f3e2f4
Create Date: 2019-04-25 16:51:03.302314
"""

Expand All @@ -11,7 +11,7 @@

# revision identifiers, used by Alembic.
revision = "708f6f26b4b6"
down_revision = "1ab95561edae"
down_revision = "e34988f3e2f4"


def upgrade():
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Add statistics to run
Revision ID: e34988f3e2f4
Revises: 708f6f26b4b6
Revises: 1ab95561edae
Create Date: 2019-03-14 15:41:11.614870
"""

Expand All @@ -11,7 +11,7 @@

# revision identifiers, used by Alembic.
revision = "e34988f3e2f4"
down_revision = "708f6f26b4b6"
down_revision = "1ab95561edae"


def upgrade():
Expand Down
4 changes: 2 additions & 2 deletions ansible/roles/anitya-dev/tasks/db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
- name: Create /home/vagrant/alembic.ini
replace:
dest: /home/vagrant/alembic.ini
regexp: "^script_location = alembic*$"
replace: "script_location = devel/alembic"
regexp: "^script_location = anitya.*$"
replace: "script_location = devel/anitya/db/migrations"

- name: Switch the database connection to postgres
replace:
Expand Down
1 change: 1 addition & 0 deletions news/819.bug
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
One revision is skipped when doing `alembic upgrade head`

0 comments on commit 1afe579

Please sign in to comment.