Fix: Do not store timezone in database. I am using UTC everywhere and use of timezones messes up date comparison.
This commit is contained in:
parent
581d9ca507
commit
35a431d37e
1
barker/.gitignore
vendored
1
barker/.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
*.pyc
|
||||
*/__pycache__/
|
||||
*.egg-info/
|
||||
poetry.lock
|
||||
|
@ -192,7 +192,7 @@ def upgrade():
|
||||
sa.Column("name", sa.Unicode(length=255), nullable=False),
|
||||
sa.Column("section_id", postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column("enabled", sa.Boolean(), nullable=False),
|
||||
sa.Column("creation_date", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("creation_date", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(["section_id"], ["sections.id"], name=op.f("fk_devices_section_id_sections")),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_devices")),
|
||||
sa.UniqueConstraint("name", name=op.f("uq_devices_name")),
|
||||
@ -202,7 +202,7 @@ def upgrade():
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
||||
sa.Column("user_id", postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column("device_id", postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column("date", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("date", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(["device_id"], ["devices.id"], name=op.f("fk_login_history_device_id_devices")),
|
||||
sa.ForeignKeyConstraint(["user_id"], ["users.id"], name=op.f("fk_login_history_user_id_users")),
|
||||
sa.PrimaryKeyConstraint("id", name=op.f("pk_login_history")),
|
||||
@ -229,7 +229,7 @@ def upgrade():
|
||||
sa.Column("id", postgresql.UUID(as_uuid=True), server_default=sa.text("gen_random_uuid()"), nullable=False),
|
||||
sa.Column("customer_id", postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column("pax", sa.Integer, nullable=False),
|
||||
sa.Column("creation_date", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("creation_date", sa.DateTime(), nullable=False),
|
||||
sa.ForeignKeyConstraint(
|
||||
["customer_id"],
|
||||
["customers.id"],
|
||||
@ -369,8 +369,8 @@ def upgrade():
|
||||
sa.Column("pax", sa.Integer(), nullable=False),
|
||||
sa.Column("bill_id", sa.Integer(), nullable=True),
|
||||
sa.Column("kot_id", sa.Integer(), nullable=False),
|
||||
sa.Column("creation_date", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("last_edit_date", sa.DateTime(timezone=True), nullable=False),
|
||||
sa.Column("creation_date", sa.DateTime(), nullable=False),
|
||||
sa.Column("last_edit_date", sa.DateTime(), nullable=False),
|
||||
sa.Column("food_table_id", postgresql.UUID(as_uuid=True), nullable=False),
|
||||
sa.Column("customer_id", postgresql.UUID(as_uuid=True), nullable=True),
|
||||
sa.Column("narration", sa.Unicode(length=1000), nullable=True),
|
||||
|
@ -20,7 +20,7 @@ class Device(Base):
|
||||
name = Column("name", Unicode(255), unique=True, nullable=False)
|
||||
enabled = Column("enabled", Boolean, nullable=False)
|
||||
section_id = Column("section_id", UUID(as_uuid=True), ForeignKey("sections.id"), nullable=False)
|
||||
creation_date = Column("creation_date", DateTime(timezone=True), nullable=False)
|
||||
creation_date = Column("creation_date", DateTime(), nullable=False)
|
||||
|
||||
section = relationship("Section", foreign_keys=section_id)
|
||||
login_history = relationship("LoginHistory", order_by=desc(LoginHistory.date), backref="device")
|
||||
|
@ -15,7 +15,7 @@ class GuestBook(Base):
|
||||
)
|
||||
customer_id = Column("customer_id", UUID(as_uuid=True), ForeignKey("customers.id"), nullable=False)
|
||||
pax = Column("pax", Integer, nullable=False)
|
||||
date = Column("creation_date", DateTime(timezone=True), nullable=False)
|
||||
date = Column("creation_date", DateTime(), nullable=False)
|
||||
|
||||
customer = relationship("Customer")
|
||||
|
||||
|
@ -20,7 +20,7 @@ class LoginHistory(Base):
|
||||
ForeignKey("devices.id"),
|
||||
nullable=False,
|
||||
)
|
||||
date = Column("date", DateTime(timezone=True), nullable=False)
|
||||
date = Column("date", DateTime(), nullable=False)
|
||||
|
||||
def __init__(self, user_id=None, device_id=None, date=None, id_=None):
|
||||
self.user_id = user_id
|
||||
|
@ -28,8 +28,8 @@ class Voucher(Base):
|
||||
pax = Column("pax", Integer, nullable=False)
|
||||
bill_id = Column("bill_id", Integer)
|
||||
kot_id = Column("kot_id", Integer, nullable=False, unique=True)
|
||||
creation_date = Column("creation_date", DateTime(timezone=True), nullable=False)
|
||||
last_edit_date = Column("last_edit_date", DateTime(timezone=True), nullable=False)
|
||||
creation_date = Column("creation_date", DateTime(), nullable=False)
|
||||
last_edit_date = Column("last_edit_date", DateTime(), nullable=False)
|
||||
food_table_id = Column(
|
||||
"food_table_id",
|
||||
UUID(as_uuid=True),
|
||||
|
1
bookie/.gitignore
vendored
1
bookie/.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
package-lock.json
|
||||
# See http://help.github.com/ignore-files/ for more about ignoring files.
|
||||
|
||||
# compiled output
|
||||
|
Loading…
Reference in New Issue
Block a user