Skip to content

Commit

Permalink
Upgrade Date to DateTime without (additional) migration!
Browse files Browse the repository at this point in the history
  • Loading branch information
jfeil committed Apr 17, 2022
1 parent 987d7e2 commit 05ac9a5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions alembic/versions/be003b0637e8_.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def upgrade():
sa.Column('title', sa.String(), nullable=True),
sa.Column('description', sa.String(), nullable=True),
sa.Column('icon', sa.BLOB(), nullable=True),
sa.Column('created', sa.Date(), nullable=True),
sa.Column('created', sa.DateTime(), nullable=True),
sa.PrimaryKeyConstraint('id')
)
op.create_table('regeltest_question_assoc',
Expand All @@ -38,7 +38,7 @@ def upgrade():
sa.Column('level', sa.Integer(), nullable=True),
sa.Column('correct_solved', sa.Integer(), nullable=True),
sa.Column('wrong_solved', sa.Integer(), nullable=True),
sa.Column('last_tested', sa.Date(), nullable=True),
sa.Column('last_tested', sa.DateTime(), nullable=True),
sa.ForeignKeyConstraint(['question_signature'], ['question.signature'], ),
sa.PrimaryKeyConstraint('question_signature')
)
Expand Down
6 changes: 3 additions & 3 deletions src/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from typing import List, Tuple, Dict

import bs4
from sqlalchemy import Column, Integer, String, ForeignKey, Date, Table, BLOB
from sqlalchemy import Column, Integer, String, ForeignKey, Date, Table, BLOB, DateTime
from sqlalchemy.orm import relationship

from src.basic_config import Base, EagerDefault
Expand All @@ -27,7 +27,7 @@ class Regeltest(Base):
description = Column(String)
icon = Column(BLOB)

created = Column(Date, default=date.today)
created = Column(DateTime, default=datetime.now)

questions = relationship("Question", secondary=regeltest_question_assoc, back_populates="regeltests")

Expand All @@ -42,7 +42,7 @@ class Statistics(Base):
level = Column(Integer, default=0)
correct_solved = Column(Integer, default=0)
wrong_solved = Column(Integer, default=0)
last_tested = Column(Date, default=default_date)
last_tested = Column(DateTime, default=datetime.fromtimestamp(0))


class QuestionGroup(Base):
Expand Down

0 comments on commit 05ac9a5

Please sign in to comment.