Skip to content

Commit

Permalink
[vagrant][frontend] comments on our alembic history in Vagrantfile an…
Browse files Browse the repository at this point in the history
…d some (related) edits in the latest migration
  • Loading branch information
clime committed Mar 4, 2016
1 parent fe80424 commit 56dee5e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ Vagrant.configure(2) do |config|
# However, I need to run an alembic script to create the SQL functions
# for builds and monitor. Well, I just downgrade behind this point and
# back again. This way, I'll have my functions!
# TODO: we should put the functions separately and throw the current alembic history away
# as it is buggy (e.g. 'manage.py db migrate' was not called after adding legal_flag model).
# There should be probly an sql script (with the functions and perhaps other db stuff
# that cannot be kept 1:1 with models) and create_db cmd of manage.py will execute it.
# I don't see a better way. A new alembic history should be started.
frontend.vm.provision "shell",
inline: "cd /usr/share/copr/coprs_frontend/ && sudo alembic downgrade 3ec22e1db75a"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@


def upgrade():
op.drop_index('build_ended_on_canceled_started_on', table_name='build')
#op.drop_index('build_ended_on_canceled_started_on', table_name='build') # clime: because this wasn't defined in models.py before, applying this migration might not succeed (indeces from 20140423001_add_indexes.py migration need to present in db)
op.drop_column('build', 'ended_on')
op.drop_column('build', 'started_on')
op.create_index('build_canceled', 'build', ['canceled'], unique=False)
#op.create_index('build_canceled', 'build', ['canceled'], unique=False)


def downgrade():
op.drop_index('build_canceled', table_name='build')
#op.drop_index('build_canceled', table_name='build') # clime: this is not currently defined in models.py so dropping here will fail unless we run on db where upgrade func of this migration has been called
op.add_column('build', sa.Column('started_on', sa.INTEGER(), autoincrement=False, nullable=True))
op.add_column('build', sa.Column('ended_on', sa.INTEGER(), autoincrement=False, nullable=True))
op.create_index('build_ended_on_canceled_started_on', 'build', ['ended_on', 'canceled', 'started_on'], unique=False)
#op.create_index('build_ended_on_canceled_started_on', 'build', ['ended_on', 'canceled', 'started_on'], unique=False)

0 comments on commit 56dee5e

Please sign in to comment.