Initial Alembic support
ClosedPublic

Authored by jskladan on Feb 23 2015, 4:50 PM.

Details

Summary

Added the initial Alembic configuration and migration files.
The first migration makes sure to create the indexes on the result_data table.

Test Plan

Tested locally

Diff Detail

Repository
rRSDB resultsdb
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
jskladan retitled this revision from to Initial Alembic support.Feb 23 2015, 4:50 PM
jskladan updated this object.
jskladan edited the test plan for this revision. (Show Details)
jskladan added reviewers: tflink, mkrizek, kparal.

This looks good to me but I'm wondering if cli.py should be enhanced to use alembic to create the db instead of raw sqla and to support upgrades of the schema

In D291#5154, @tflink wrote:

wondering if cli.py should be enhanced to use alembic

Yup it is definitely worth it, I just did not feel like spending time on it at the moment. Would it be OK with you to add the cli.py modifications after?

jskladan updated this revision to Diff 796.Feb 24 2015, 11:26 AM
  • Changed the cli.py to use Alembic
jskladan updated this revision to Diff 797.Feb 24 2015, 11:28 AM
  • Forgot to remove the FIXME comment
jskladan updated this revision to Diff 798.Feb 24 2015, 1:28 PM
  • Fixed the testsuite
jskladan updated this revision to Diff 800.Feb 24 2015, 2:07 PM
  • Added alembic to specfile
tflink requested changes to this revision.Feb 24 2015, 5:32 PM

Overall, looks good to me. Just the minor concern about the logic in initialize_db and would be nice to have alembic in requirements.txt

resultsdb/cli.py
75

I think that this logic needs to be reworked a bit so that the drop_all() and create_all() are combined with current_rev so that the alembic revision is initialized.

I tried this code locally and it seems to work for a trivial usecase but it still concerns me a little

This revision now requires changes to proceed.Feb 24 2015, 5:32 PM
jskladan updated this revision to Diff 801.Feb 24 2015, 7:42 PM
  • Changed the init_db process to be saner
tflink accepted this revision.Feb 25 2015, 4:43 AM

other than the alembic README, looks good

alembic/README
1 ↗(On Diff #801)

It seems kinda silly to have this in git - can you either remove it from the revision or fill it out with something less generic?

This revision is now accepted and ready to land.Feb 25 2015, 4:43 AM
Closed by commit rRSDB9557a3ca41e4: Initial Alembic support (authored by Josef Skladanka <jskladan@redhat.com>). · Explain WhyFeb 26 2015, 3:30 PM
This revision was automatically updated to reflect the committed changes.