Skip to content
This repository has been archived by the owner on Dec 29, 2024. It is now read-only.

Commit

Permalink
Fixed default field value bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanCheetah committed Jun 28, 2023
1 parent 3b12bc1 commit 7dddd62
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion cheetah_orm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
__author__ = "Cybermals"
__copyright__ = "Copyright (c) 2023 by Cybermals"
__license__ = "MIT"
__version__ = "2.0.0b5"
__version__ = "2.0.0b6"
6 changes: 5 additions & 1 deletion cheetah_orm/mappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,11 @@ def init_model(self, model):

# Add default value
if default is not None:
col += f" DEFAULT '{default}'"
# Handle now()
if default == "now()":
default = "'now()'"

col += f" DEFAULT {default}"

field_sql += f"{col},"

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "cheetah_orm"
version = "2.0.0b5"
version = "2.0.0b6"
authors = [
{name="Cybermals", email="[email protected]"}
]
Expand Down
Binary file modified test.db
Binary file not shown.

0 comments on commit 7dddd62

Please sign in to comment.