Repository: fossasia/open-event-server

Issue:
 Change url fields in speakers db
Rename following fields in speakers db:
- [x] photo -> photo_url
- [x] thumbnail -> thumbnail_image_url
- [x] small -> small_image_url
- [x] icon -> icon_image_url



Discussion:

Resolving patch:
diff --git a/app/models/speaker.py b/app/models/speaker.py
--- a/app/models/speaker.py
+++ b/app/models/speaker.py
@@ -7,10 +7,10 @@ class Speaker(db.Model):
     __tablename__ = 'speaker'
     id = db.Column(db.Integer, primary_key=True)
     name = db.Column(db.String, nullable=False)
-    photo = db.Column(db.String)
-    thumbnail = db.Column(db.String)
-    small = db.Column(db.String)
-    icon = db.Column(db.String)
+    photo_url = db.Column(db.String)
+    thumbnail_image_url = db.Column(db.String)
+    small_image_url = db.Column(db.String)
+    icon_image_url = db.Column(db.String)
     short_biography = db.Column(db.Text)
     long_biography = db.Column(db.Text)
     speaking_experience = db.Column(db.Text)
@@ -59,10 +59,10 @@ def __init__(self,
                  event_id=None,
                  user_id=None):
         self.name = name
-        self.photo = photo_url
-        self.thumbnail = thumbnail_image_url
-        self.small = small_image_url
-        self.icon = icon_image_url
+        self.photo_url = photo_url
+        self.thumbnail_image_url = thumbnail_image_url
+        self.small_image_url = small_image_url
+        self.icon_image_url = icon_image_url
         self.short_biography = short_biography
         self.long_biography = long_biography
         self.speaking_experience = speaking_experience
@@ -113,10 +113,10 @@ def serialize(self):
         return {
             'id': self.id,
             'name': self.name,
-            'photo': self.photo,
-            'thumbnail': self.thumbnail,
-            'small': self.small,
-            'icon': self.icon,
+            'photo_url': self.photo_url,
+            'thumbnail_image_url': self.thumbnail_image_url,
+            'small_image_url': self.small_image_url,
+            'icon_image_url': self.icon_image_url,
             'short_biography': self.short_biography,
             'long_biography': self.long_biography,
             'speaking_experience': self.speaking_experience,
diff --git a/migrations/versions/76c457093e38_.py b/migrations/versions/76c457093e38_.py
new file mode 100644
--- /dev/null
+++ b/migrations/versions/76c457093e38_.py
@@ -0,0 +1,31 @@
+"""empty message
+
+Revision ID: 76c457093e38
+Revises: bf3e8c2a01f6
+Create Date: 2017-08-11 22:59:11.276589
+
+"""
+
+from alembic import op
+
+# revision identifiers, used by Alembic.
+revision = '76c457093e38'
+down_revision = 'bf3e8c2a01f6'
+
+
+def upgrade():
+    # commands auto generated by Alembic - please adjust! #
+    op.alter_column('speaker', 'photo', new_column_name='photo_url')
+    op.alter_column('speaker', 'thumbnail', new_column_name='thumbnail_image_url')
+    op.alter_column('speaker', 'small', new_column_name='small_image_url')
+    op.alter_column('speaker', 'icon', new_column_name='icon_image_url')
+    # end Alembic commands #
+
+
+def downgrade():
+    # commands auto generated by Alembic - please adjust! #
+    op.alter_column('speaker', 'photo_url', new_column_name='photo')
+    op.alter_column('speaker', 'thumbnail_image_url', new_column_name='thumbnail')
+    op.alter_column('speaker', 'small_image_url', new_column_name='small')
+    op.alter_column('speaker', 'icon_image_url', new_column_name='icon')
+    # end Alembic commands #


Test patch: