1
0
Fork 0

Add NOT NULL constraint to `accounts`.`username`

This commit is contained in:
Alex Kotov 2019-02-01 06:21:39 +05:00
parent 0923e91b85
commit dc4857ce00
Signed by: kotovalexarian
GPG Key ID: 553C0EBBEB5D5F08
2 changed files with 10 additions and 2 deletions

View 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

View File

@ -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