Skip to content

Commit

Permalink
add mention of using :now in Time fields. Fixes #1214 (#1239)
Browse files Browse the repository at this point in the history
  • Loading branch information
jwoertink authored Sep 13, 2023
1 parent 45cbe62 commit 7eb7415
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/actions/guides/database/migrations.cr
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class Guides::Database::Migrations < GuideAction
add login_count : Int32, default: 0
add tags : Array(String)
add preferences : JSON::Any
add key : String, index: true
end
```
Expand Down Expand Up @@ -355,6 +356,8 @@ class Guides::Database::Migrations < GuideAction
alter table_for(User) do
# set all existing, and future users `active` to `true`
add active : Bool, default: true
# `:now` is a special symbol that casts to NOW() for Time columns
add active_at : Time, default: :now
# set all existing users `otp_code` to `"fake-otp-code-123".
# New users will require a value to be set.
Expand Down

0 comments on commit 7eb7415

Please sign in to comment.