Repository: fossasia/open-event-server

Issue:
GET for the endpoint -/any/<any_id>/event- gives "ProgrammingError: (psycopg2.ProgrammingError) column speaker.is_featured does not exist"
**I'm submitting a ...**  (check one with "x")
- [X] bug report
- [ ] feature request
- [ ] support request => Please do not submit support requests here, instead ask your query in out Gitter channel at https://gitter.im/fossasia/open-event-orga-server


**Steps to reproduce:**
<!-- If you are able to illustrate the bug or feature request with an example, please provide steps to reproduce -->
example: GET `tracks/<id>/event`
 
**Full log:**
ProgrammingError: (psycopg2.ProgrammingError) column speaker.is_featured does not exist
LINE 1: ...in, speaker.organisation AS speaker_organisation, speaker.is...
                                                             ^
HINT:  Perhaps you meant to reference the column "speaker.featured".
 [SQL: 'SELECT speaker.id AS speaker_id, speaker.name AS speaker_name, speaker.photo AS speaker_photo, speaker.thumbnail AS speaker_thumbnail, speaker.small AS speaker_small, speaker.icon AS speaker_icon, speaker.short_biography AS speaker_short_biography, speaker.long_biography AS speaker_long_biography, speaker.speaking_experience AS speaker_speaking_experience, speaker.email AS speaker_email, speaker.mobile AS speaker_mobile, speaker.website AS speaker_website, speaker.twitter AS speaker_twitter, speaker.facebook AS speaker_facebook, speaker.github AS speaker_github, speaker.linkedin AS speaker_linkedin, speaker.organisation AS speaker_organisation, speaker.is_featured AS speaker_is_featured, speaker.position AS speaker_position, speaker.country AS speaker_country, speaker.city AS speaker_city, speaker.gender AS speaker_gender, speaker.heard_from AS speaker_heard_from, speaker.sponsorship_required AS speaker_sponsorship_required, speaker.event_id AS speaker_event_id, speaker.user_id AS speaker_user_id \nFROM speaker \nWHERE %(param_1)s = speaker.event_id'] [parameters: {'param_1': 42}]


Discussion:

Resolving patch:
diff --git a/app/models/image_config.py b/app/models/image_config.py
deleted file mode 100644
--- a/app/models/image_config.py
+++ /dev/null
@@ -1,31 +0,0 @@
-from app.models import db
-
-
-class ImageConfig(db.Model):
-    """image config model class"""
-    __tablename__ = 'image_config'
-    id = db.Column(db.Integer,
-                   primary_key=True)
-    page = db.Column(db.String)
-    size = db.Column(db.String)
-
-    def __init__(self,
-                 page=None,
-                 size=None):
-        self.page = page
-        self.size = size
-
-    def __str__(self):
-        return 'Page:' + unicode(self.page).encode('utf-8')
-
-    def __unicode__(self):
-        return unicode(self.id)
-
-    @property
-    def serialize(self):
-        """Return object data in easily serializable format"""
-        return {
-            'id': self.id,
-            'page': self.page,
-            'size': self.size
-        }
diff --git a/migrations/versions/526dec6f4aff_.py b/migrations/versions/526dec6f4aff_.py
new file mode 100644
--- /dev/null
+++ b/migrations/versions/526dec6f4aff_.py
@@ -0,0 +1,34 @@
+"""empty message
+
+Revision ID: 526dec6f4aff
+Revises: 8500f5ec6c45
+Create Date: 2017-07-17 18:47:02.086751
+
+"""
+
+from alembic import op
+import sqlalchemy as sa
+
+# revision identifiers, used by Alembic.
+revision = '526dec6f4aff'
+down_revision = '8500f5ec6c45'
+
+def upgrade():
+    # commands auto generated by Alembic - please adjust! #
+    op.add_column('speaker', sa.Column('is_featured', sa.Boolean(), nullable=True))
+    op.drop_column('speaker', 'featured')
+    op.drop_table('image_config')
+    # end Alembic commands #
+
+
+def downgrade():
+    # commands auto generated by Alembic - please adjust! #
+    op.add_column('speaker', sa.Column('featured', sa.BOOLEAN(), autoincrement=False, nullable=True))
+    op.drop_column('speaker', 'is_featured')
+    op.create_table('image_config',
+    sa.Column('id', sa.INTEGER(), nullable=False),
+    sa.Column('page', sa.VARCHAR(), autoincrement=False, nullable=True),
+    sa.Column('size', sa.VARCHAR(), autoincrement=False, nullable=True),
+    sa.PrimaryKeyConstraint('id', name=u'image_config_pkey')
+    )
+    # end Alembic commands #


Test patch: