onyxframework / sql

A delightful SQL ORM ☺️
https://api.onyxframework.com/sql
MIT License
91 stars 7 forks source link

`not_null` key #69

Closed vladfaust closed 5 years ago

vladfaust commented 5 years ago
class User
  schema users do
    type created_at : Time, default: true, not_null: true
    type updated_at : Time
  end

  # Expands to
  #

  property! created_at : Time
  property updated_at : Time # Note that it is not bang
end

User.update.set(created_at: nil) # Compilation-time error
User.update.set(updated_at: nil) # OK