Add NOT NULL constraint to accounts
.username
This commit is contained in:
parent
0923e91b85
commit
dc4857ce00
2 changed files with 10 additions and 2 deletions
8
db/migrate/20190201012021_unique_username_of_accounts.rb
Normal file
8
db/migrate/20190201012021_unique_username_of_accounts.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class UniqueUsernameOfAccounts < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
change_column :accounts, :username, :string, null: false,
|
||||
index: { unique: true }
|
||||
end
|
||||
end
|
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2019_02_01_002444) do
|
||||
ActiveRecord::Schema.define(version: 2019_02_01_012021) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -39,7 +39,7 @@ ActiveRecord::Schema.define(version: 2019_02_01_002444) do
|
|||
t.datetime "updated_at", null: false
|
||||
t.string "guest_token", null: false
|
||||
t.bigint "person_id"
|
||||
t.string "username"
|
||||
t.string "username", null: false
|
||||
t.index ["person_id"], name: "index_accounts_on_person_id", unique: true
|
||||
end
|
||||
|
||||
|
|
Reference in a new issue