From 80f65b008f0fee80734f53c39eda4be7b559b188 Mon Sep 17 00:00:00 2001 From: Giulia Naponiello Date: Feb 23 2018 13:38:01 +0000 Subject: Fixes for the change from SQLite to PostgreSQL * Removed a warning in the tests adding psycopg2-binary to the requirements.txt. * Removed code that was used only for SQLite compatibility (no more needed since we moved to PostgreSQL). * Added requirement of psycopg2 in the spec file. --- diff --git a/requirements.txt b/requirements.txt index 14951b7..f4e9547 100644 --- a/requirements.txt +++ b/requirements.txt @@ -26,3 +26,6 @@ click configparser openidc-client requests-kerberos + +# Database +psycopg2-binary diff --git a/waiverdb.spec b/waiverdb.spec index 6ceb951..9916127 100644 --- a/waiverdb.spec +++ b/waiverdb.spec @@ -23,6 +23,7 @@ BuildRequires: python-sqlalchemy %endif BuildRequires: python2-flask-restful BuildRequires: python2-flask-sqlalchemy +BuildRequires: python2-psycopg2 BuildRequires: python2-kerberos BuildRequires: python2-systemd BuildRequires: python2-pytest @@ -38,6 +39,7 @@ BuildRequires: python-flask BuildRequires: python-sqlalchemy BuildRequires: python-flask-restful BuildRequires: python-flask-sqlalchemy +BuildRequires: python-psycopg2 BuildRequires: python-kerberos BuildRequires: systemd-python BuildRequires: pytest @@ -61,6 +63,7 @@ Requires: python-sqlalchemy %endif Requires: python2-flask-restful Requires: python2-flask-sqlalchemy +Requires: python2-psycopg2 Requires: python2-kerberos Requires: python2-systemd Requires: python2-mock @@ -74,6 +77,7 @@ Requires: python-flask Requires: python-sqlalchemy Requires: python-flask-restful Requires: python-flask-sqlalchemy +Requires: python-psycopg2 Requires: python-kerberos Requires: systemd-python Requires: python-mock diff --git a/waiverdb/migrations/versions/ed43eb9b221c_set_nullable_on_new_and_old_fields.py b/waiverdb/migrations/versions/ed43eb9b221c_set_nullable_on_new_and_old_fields.py index 1ffe0b1..4d28209 100644 --- a/waiverdb/migrations/versions/ed43eb9b221c_set_nullable_on_new_and_old_fields.py +++ b/waiverdb/migrations/versions/ed43eb9b221c_set_nullable_on_new_and_old_fields.py @@ -14,17 +14,12 @@ from alembic import op def upgrade(): - # SQLite has some problem in dropping/altering columns. - # So in this way Alembic should do some behind the scenes - # with: make new table - copy data - drop old table - rename new table - with op.batch_alter_table('waiver') as batch_op: - batch_op.alter_column('subject', nullable=False) - batch_op.alter_column('testcase', nullable=False) - batch_op.alter_column('result_id', nullable=True) + op.alter_column('waiver', 'subject', nullable=False) + op.alter_column('waiver', 'testcase', nullable=False) + op.alter_column('waiver', 'result_id', nullable=True) def downgrade(): - with op.batch_alter_table('waiver') as batch_op: - batch_op.alter_column('subject', nullable=True) - batch_op.alter_column('testcase', nullable=True) - batch_op.alter_column('result_id', nullable=False) + op.alter_column('waiver', 'subject', nullable=True) + op.alter_column('waiver', 'testcase', nullable=True) + op.alter_column('waiver', 'result_id', nullable=False)