Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
Update session_time enum style (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
kujyp committed Apr 12, 2018
1 parent 4cd6e51 commit 444b6eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
8 changes: 3 additions & 5 deletions app/database/models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import enum
from datetime import datetime

from pytz import timezone
Expand Down Expand Up @@ -52,9 +51,7 @@ def __repr__(self):
return '<Library %r>' % self.name


class SessionEnum(enum.Enum):
first = "09:00"
second = "10:00"
session_time_choices = ["09:00", "10:00"]


def now_at_seoul():
Expand All @@ -80,7 +77,8 @@ class Speaker(db.Model, TimestampMixin):
password = db.Column(db.String(30), nullable=False)
is_email_verified = db.Column(db.Boolean, default=False)
email_sended_at = db.Column(db.DateTime, nullable=True)
session_time = db.Column(db.Enum(SessionEnum), nullable=False)
session_time = db.Column(db.Enum(*session_time_choices),
nullable=False)
library_id = db.Column(INTEGER(11, unsigned=True),
db.ForeignKey('Libraries.id'),
nullable=False)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"""empty message
Revision ID: 6c0fbb516dfd
Revision ID: ba0d91c0bfc5
Revises: ad3c95a8a551
Create Date: 2018-04-11 23:34:31.356913
Create Date: 2018-04-12 13:31:37.508738
"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision = '6c0fbb516dfd'
revision = 'ba0d91c0bfc5'
down_revision = 'ad3c95a8a551'
branch_labels = None
depends_on = None
Expand All @@ -28,7 +28,7 @@ def upgrade():
sa.Column('password', sa.String(length=30), nullable=False),
sa.Column('is_email_verified', sa.Boolean(), nullable=True),
sa.Column('email_sended_at', sa.DateTime(), nullable=True),
sa.Column('session_time', sa.Enum('first', 'second', name='sessionenum'), nullable=False),
sa.Column('session_time', sa.Enum('09:00', '10:00'), nullable=False),
sa.Column('library_id', mysql.INTEGER(display_width=11, unsigned=True), nullable=False),
sa.ForeignKeyConstraint(['library_id'], ['Libraries.id'], ),
sa.PrimaryKeyConstraint('id'),
Expand Down

1 comment on commit 444b6eb

@kujyp
Copy link
Contributor Author

@kujyp kujyp commented on 444b6eb Apr 12, 2018

Choose a reason for hiding this comment

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

restful api CRUD 구현중 enum에서 문제가 발생하여, list타입 사용하도록 수정했습니다.

Please sign in to comment.