Skip to content

Commit

Permalink
fix: Remove type creation for postgresql (#3438)
Browse files Browse the repository at this point in the history
<!-- Thanks for your contribution! As part of our Community Growers
initiative 🌱, we're donating Justdiggit bunds in your name to reforest
sub-Saharan Africa. To claim your Community Growers certificate, please
contact David Berenstein in our Slack community or fill in this form
https://tally.so/r/n9XrxK once your PR has been merged. -->

# Description

The last alembic migration definitions fail when using PostgreSQL as the
database. This PR fixes this by allowing upgrade and downgrade properly.
For more info about the problem, see here
sqlalchemy/alembic#886


**Type of change**

(Please delete options that are not relevant. Remember to title the PR
according to the type of change)

- [X] Bug fix (non-breaking change which fixes an issue)

**How Has This Been Tested**

Changes have been tested using a local database to apply migrations
(update and downgrade)

**Checklist**

- [ ] I added relevant documentation
- [ ] follows the style guidelines of this project
- [ ] I did a self-review of my code
- [ ] I made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [ ] I filled out [the contributor form](https://tally.so/r/n9XrxK)
(see text above)
- [ ] I have added relevant notes to the CHANGELOG.md file (See
https://keepachangelog.com/)

---------

Co-authored-by: Francisco Aranda <francisco@recogn.ai>
  • Loading branch information
frascuchon and Francisco Aranda committed Jul 21, 2023
1 parent f8a5c0c commit 6ca128f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ These are the section headers that we use:

## [Unreleased]

## [1.13.1](https://github.com/argilla-io/argilla/compare/v1.13.0...v1.13.1)

### Fixed

- Fix database migration for PostgreSQL (See [#3438](https://github.com/argilla-io/argilla/pull/3438))

## [1.13.0](https://github.com/argilla-io/argilla/compare/v1.12.1...v1.13.0)

### Added
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@


def upgrade() -> None:
bind = op.get_bind()

if bind.dialect.name == "postgresql":
suggestion_type_enum.create(bind)

# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"suggestions",
Expand Down Expand Up @@ -70,5 +65,6 @@ def downgrade() -> None:
op.drop_table("suggestions")
# ### end Alembic commands ###

# For this see here: https://github.com/sqlalchemy/alembic/issues/886
if bind.dialect.name == "postgresql":
suggestion_type_enum.drop(bind)

0 comments on commit 6ca128f

Please sign in to comment.