Repository: fedora-infra/bodhi

Issue:
The non-NULL comment text migration needs to be inserted before 4df1fcd59050
This migration was developed against the develop branch, but I had forgotten that there was already a migration in the develop branch that isn't on the 2.2 branch. We'll need to change both migrations so that the new one is inserted before the prior one:

```
[vagrant@localhost vagrant]$ alembic upgrade head
WARNING:fedmsg.crypto.x509:Crypto disabled ImportError('No module named M2Crypto',)
INFO  [alembic.runtime.migration] Context impl PostgresqlImpl.
INFO  [alembic.runtime.migration] Will assume transactional DDL.
/usr/lib/python2.7/site-packages/alembic/util/messaging.py:69: UserWarning: Revision 4df1fcd59050 referenced from 4df1fcd59050 -> 37f38ddc4c8d (head), Do not allow NULL values in the text column of the comments table. is not present
  warnings.warn(msg)
Traceback (most recent call last):
  File "/usr/bin/alembic", line 9, in <module>
    load_entry_point('alembic==0.8.3', 'console_scripts', 'alembic')()
  File "/usr/lib/python2.7/site-packages/alembic/config.py", line 450, in main
    CommandLine(prog=prog).main(argv=argv)
  File "/usr/lib/python2.7/site-packages/alembic/config.py", line 444, in main
    self.run_cmd(cfg, options)
  File "/usr/lib/python2.7/site-packages/alembic/config.py", line 427, in run_cmd
    **dict((k, getattr(options, k)) for k in kwarg)
  File "/usr/lib/python2.7/site-packages/alembic/command.py", line 174, in upgrade
    script.run_env()
  File "/usr/lib/python2.7/site-packages/alembic/script/base.py", line 397, in run_env
    util.load_python_file(self.dir, 'env.py')
  File "/usr/lib/python2.7/site-packages/alembic/util/pyfiles.py", line 81, in load_python_file
    module = load_module_py(module_id, path)
  File "/usr/lib/python2.7/site-packages/alembic/util/compat.py", line 79, in load_module_py
    mod = imp.load_source(module_id, path, fp)
  File "alembic/env.py", line 72, in <module>
    run_migrations_online()
  File "alembic/env.py", line 65, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/usr/lib/python2.7/site-packages/alembic/runtime/environment.py", line 797, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/usr/lib/python2.7/site-packages/alembic/runtime/migration.py", line 303, in run_migrations
    for step in self._migrations_fn(heads, self):
  File "/usr/lib/python2.7/site-packages/alembic/command.py", line 163, in upgrade
    return script._upgrade_revs(revision, rev)
  File "/usr/lib/python2.7/site-packages/alembic/script/base.py", line 310, in _upgrade_revs
    revs = list(revs)
  File "/usr/lib/python2.7/site-packages/alembic/script/revision.py", line 610, in _iterate_revisions
    requested_lowers = self.get_revisions(lower)
  File "/usr/lib/python2.7/site-packages/alembic/script/revision.py", line 299, in get_revisions
    return sum([self.get_revisions(id_elem) for id_elem in id_], ())
  File "/usr/lib/python2.7/site-packages/alembic/script/revision.py", line 301, in get_revisions
    resolved_id, branch_label = self._resolve_revision_number(id_)
  File "/usr/lib/python2.7/site-packages/alembic/script/revision.py", line 423, in _resolve_revision_number
    self._revision_map
  File "/usr/lib/python2.7/site-packages/alembic/util/langhelpers.py", line 241, in __get__
    obj.__dict__[self.__name__] = result = self.fget(obj)
  File "/usr/lib/python2.7/site-packages/alembic/script/revision.py", line 151, in _revision_map
    down_revision = map_[downrev]
KeyError: '4df1fcd59050'
```

It needs to be possible to vagrant up on the 2.2 branch and then advance to the develop branch.



Discussion:

Resolving patch:
diff --git a/alembic/versions/37f38ddc4c8d_.py b/alembic/versions/37f38ddc4c8d_.py
--- a/alembic/versions/37f38ddc4c8d_.py
+++ b/alembic/versions/37f38ddc4c8d_.py
@@ -1,7 +1,7 @@
 """Do not allow NULL values in the text column of the comments table.
 
 Revision ID: 37f38ddc4c8d
-Revises: 4df1fcd59050
+Revises: 3c72757fa59e
 Create Date: 2016-09-21 19:51:04.946521
 
 """
@@ -12,7 +12,7 @@
 
 # revision identifiers, used by Alembic.
 revision = '37f38ddc4c8d'
-down_revision = '4df1fcd59050'
+down_revision = '3c72757fa59e'
 
 
 def upgrade():
diff --git a/alembic/versions/4df1fcd59050_.py b/alembic/versions/4df1fcd59050_.py
--- a/alembic/versions/4df1fcd59050_.py
+++ b/alembic/versions/4df1fcd59050_.py
@@ -1,7 +1,7 @@
 """Add the new pending_signing_tag column to the releases table.
 
 Revision ID: 4df1fcd59050
-Revises: 3c72757fa59e
+Revises: 37f38ddc4c8d
 Create Date: 2016-09-16 18:51:19.514301
 
 """
@@ -11,7 +11,7 @@
 
 # revision identifiers, used by Alembic.
 revision = '4df1fcd59050'
-down_revision = '3c72757fa59e'
+down_revision = '37f38ddc4c8d'
 
 
 def upgrade():


Test patch: