Browse Source

Make User::email required

It shouldn't be required, but it's necessary for Carbon::Emailable.
master
Les De Ridder 4 months ago
parent
commit
b2ede45d82
3 changed files with 3 additions and 3 deletions
  1. +1
    -1
      db/migrations/00000000000001_create_users.cr
  2. +1
    -1
      src/models/role.cr
  3. +1
    -1
      src/models/user.cr

+ 1
- 1
db/migrations/00000000000001_create_users.cr View File

@@ -5,7 +5,7 @@ class CreateUsers::V00000000000001 < Avram::Migrator::Migration::V1

add name : String, unique: true
add encrypted_password : String # NOTE: Should really be called 'password_hash'
add email : String?, unique: true
add email : String, unique: true # NOTE: Should be nilable, but Carbon::Emailable doesn't really support it
add created_at : Time
end
end


+ 1
- 1
src/models/role.cr View File

@@ -3,6 +3,6 @@ class Role < BaseModel
column name : String
column description : String?

has_many users : User, foreign_key: :primary_role_id #####
has_many users : User, foreign_key: :primary_role_id
end
end

+ 1
- 1
src/models/user.cr View File

@@ -5,7 +5,7 @@ class User < BaseModel
table do
column name : String
column encrypted_password : String
column email : String?
column email : String
column created_at : Time

belongs_to primary_role : Role


Loading…
Cancel
Save