Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make annoucement filed in speakers call nullable #7435

Merged
merged 5 commits into from
Nov 12, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/api/schema/speakers_calls.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def validate_date(self, data, original_data):
# "speakers-call ends-at should be before event starts-at")

id = fields.Str(dump_only=True)
announcement = fields.Str(required=True)
announcement = fields.Str(required=False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be allow_none=True

starts_at = fields.DateTime(required=True)
ends_at = fields.DateTime(required=True)
hash = fields.Str(allow_none=True)
Expand Down
2 changes: 1 addition & 1 deletion app/models/speakers_call.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class SpeakersCall(SoftDeletionModel):

__tablename__ = 'speakers_calls'
id = db.Column(db.Integer, primary_key=True)
announcement = db.Column(db.Text, nullable=False)
announcement = db.Column(db.Text, nullable=True)
starts_at = db.Column(db.DateTime(timezone=True), nullable=False)
ends_at = db.Column(db.DateTime(timezone=True), nullable=False)
hash = db.Column(db.String, nullable=True)
Expand Down
32 changes: 32 additions & 0 deletions migrations/versions/rev-2020-11-12-09:02:31-aa9daed401f7_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""empty message

Revision ID: aa9daed401f7
Revises: 5e7082330d80
Create Date: 2020-11-12 09:02:31.174541

"""

from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils


# revision identifiers, used by Alembic.
revision = 'aa9daed401f7'
down_revision = '5e7082330d80'


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('speakers_calls', 'announcement',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After this line, please add statement for converting empty string to null as well

existing_type=sa.TEXT(),
nullable=True)
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.alter_column('speakers_calls', 'announcement',
existing_type=sa.TEXT(),
nullable=False)
# ### end Alembic commands ###