Skip to content

Commit

Permalink
adding unique index to the users barcode column (#620) (#621) (#624)
Browse files Browse the repository at this point in the history
  • Loading branch information
daryanypl authored Apr 7, 2020
1 parent 77cf885 commit 32540a8
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 26 deletions.
8 changes: 8 additions & 0 deletions db/migrate/20200323044742_add_index_to_users.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# frozen_string_literal: true

class AddIndexToUsers < ActiveRecord::Migration[5.0]
def change
change_column :users, :barcode, 'bigint'
add_index :users, :barcode, name: "index_users_barcode", unique: true
end
end
55 changes: 29 additions & 26 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20200206150637) do
ActiveRecord::Schema.define(version: 20200323044742) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand All @@ -23,8 +23,8 @@
t.string "author_type"
t.integer "author_id"
t.text "body"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "namespace"
t.index ["author_type", "author_id"], name: "index_active_admin_comments_on_author_type_and_author_id", using: :btree
t.index ["namespace"], name: "index_active_admin_comments_on_namespace", using: :btree
Expand All @@ -42,17 +42,18 @@
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "email_notifications", default: true
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "email_notifications", default: true
t.index ["email"], name: "index_admin_users_on_email", unique: true, using: :btree
t.index ["reset_password_token"], name: "index_admin_users_on_reset_password_token", unique: true, using: :btree
end

create_table "allowed_user_email_masks", force: :cascade do |t|
t.string "email_pattern", null: false
t.boolean "active", default: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.boolean "active", default: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "books", id: :bigserial, force: :cascade do |t|
Expand All @@ -69,24 +70,24 @@
t.text "notes"
t.text "statement_of_responsibility"
t.string "cover_uri"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "bnumber", limit: 20
t.index ["bnumber"], name: "index_books_bnumber", using: :btree
t.index ["title"], name: "index_books_title", using: :btree
end

create_table "boroughs", force: :cascade do |t|
t.string "name"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "campuses", force: :cascade do |t|
t.string "name"
t.integer "borough_id"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["borough_id"], name: "index_campuses_on_borough_id", using: :btree
end

Expand All @@ -95,17 +96,17 @@
t.bigint "admin_user_id"
t.string "status", limit: 9
t.text "comment"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "holds", force: :cascade do |t|
t.bigint "teacher_set_id"
t.bigint "user_id"
t.date "date_required"
t.string "status", limit: 9, default: "new"
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "access_key", limit: 30
t.integer "quantity", default: 1
t.index ["access_key"], name: "index_holds_access_key", unique: true, using: :btree
Expand All @@ -122,7 +123,7 @@
t.string "postal_code"
t.string "phone_number"
t.string "borough"
t.datetime "created_at", null: false
t.datetime "created_at", null: false
t.datetime "updated_at"
t.index ["active"], name: "index_schools_on_active", using: :btree
t.index ["campus_id"], name: "index_schools_on_campus_id", using: :btree
Expand All @@ -132,8 +133,8 @@
create_table "sierra_code_zcode_matches", force: :cascade do |t|
t.integer "sierra_code"
t.string "zcode"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end

create_table "subject_teacher_sets", id: false, force: :cascade do |t|
Expand All @@ -145,8 +146,8 @@

create_table "subjects", force: :cascade do |t|
t.string "title", limit: 30
t.datetime "created_at"
t.datetime "updated_at"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["title"], name: "index_subjects_title", unique: true, using: :btree
end

Expand Down Expand Up @@ -219,16 +220,18 @@
t.datetime "confirmed_at"
t.datetime "confirmation_sent_at"
t.string "unconfirmed_email"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.bigint "barcode"
t.string "first_name", limit: 40
t.string "last_name", limit: 40
t.string "alt_email"
t.string "home_library", limit: 6
t.integer "school_id"
t.text "alt_barcodes"
t.index ["barcode"], name: "index_users_barcode", unique: true, using: :btree
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree
t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
t.index ["school_id"], name: "index_users_on_school_id", using: :btree
end
Expand Down

0 comments on commit 32540a8

Please sign in to comment.