Skip to content

Commit

Permalink
refactor: use CURRENT_TIMESTAMP instead of NOW() in order to make it …
Browse files Browse the repository at this point in the history
…work on SQLite

Part of #53
  • Loading branch information
php-coder committed Apr 30, 2024
1 parent a74adb5 commit 940643f
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions examples/go/chi/mysql/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ func registerRoutes(r chi.Router, db *sqlx.DB) {
, :name_ru
, :slug
, :hidden
, NOW()
, CURRENT_TIMESTAMP
, :user_id
, NOW()
, CURRENT_TIMESTAMP
, :user_id
)`,
args,
Expand Down Expand Up @@ -235,7 +235,7 @@ func registerRoutes(r chi.Router, db *sqlx.DB) {
, name_ru = :name_ru
, slug = :slug
, hidden = :hidden
, updated_at = NOW()
, updated_at = CURRENT_TIMESTAMP
, updated_by = :user_id
WHERE id = :categoryId`,
args,
Expand Down
6 changes: 3 additions & 3 deletions examples/js/express/mysql/endpoints.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@
, :b.name_ru
, :b.slug
, :b.hidden
, NOW()
, CURRENT_TIMESTAMP
, :b.user_id
, NOW()
, CURRENT_TIMESTAMP
, :b.user_id
)
dto:
Expand Down Expand Up @@ -122,7 +122,7 @@
, name_ru = :b.name_ru
, slug = :b.slug
, hidden = :b.hidden
, updated_at = NOW()
, updated_at = CURRENT_TIMESTAMP
, updated_by = :b.user_id
WHERE id = :p.categoryId
dto:
Expand Down
6 changes: 3 additions & 3 deletions examples/js/express/mysql/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ const register = (app, pool) => {
, :name_ru
, :slug
, :hidden
, NOW()
, CURRENT_TIMESTAMP
, :user_id
, NOW()
, CURRENT_TIMESTAMP
, :user_id
)`,
{
Expand Down Expand Up @@ -152,7 +152,7 @@ const register = (app, pool) => {
, name_ru = :name_ru
, slug = :slug
, hidden = :hidden
, updated_at = NOW()
, updated_at = CURRENT_TIMESTAMP
, updated_by = :user_id
WHERE id = :categoryId`,
{
Expand Down
6 changes: 3 additions & 3 deletions examples/python/fastapi/postgres/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,9 @@ def post_v1_categories(body: CreateCategoryDto, conn=Depends(db_connection)):
, %(name_ru)s
, %(slug)s
, %(hidden)s
, NOW()
, CURRENT_TIMESTAMP
, %(user_id)s
, NOW()
, CURRENT_TIMESTAMP
, %(user_id)s
)
""", {
Expand Down Expand Up @@ -192,7 +192,7 @@ def put_v1_categories_category_id(body: CreateCategoryDto, categoryId, conn=Depe
, name_ru = %(name_ru)s
, slug = %(slug)s
, hidden = %(hidden)s
, updated_at = NOW()
, updated_at = CURRENT_TIMESTAMP
, updated_by = %(user_id)s
WHERE id = %(categoryId)s
""", {
Expand Down
6 changes: 3 additions & 3 deletions examples/ts/express/mysql/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ const register = (app: Express, pool: Pool) => {
, :name_ru
, :slug
, :hidden
, NOW()
, CURRENT_TIMESTAMP
, :user_id
, NOW()
, CURRENT_TIMESTAMP
, :user_id
)`,
{
Expand Down Expand Up @@ -155,7 +155,7 @@ const register = (app: Express, pool: Pool) => {
, name_ru = :name_ru
, slug = :slug
, hidden = :hidden
, updated_at = NOW()
, updated_at = CURRENT_TIMESTAMP
, updated_by = :user_id
WHERE id = :categoryId`,
{
Expand Down

0 comments on commit 940643f

Please sign in to comment.