Skip to content

Commit

Permalink
[RUBY-3212] Add unique index to projects name
Browse files Browse the repository at this point in the history
- Created migration to add unique index to `pafs_core_projects` table on the `name` column.
- Updated schema to reflect the new unique index on the `name` column.
  • Loading branch information
jjromeo committed Sep 4, 2024
1 parent 76f9c52 commit f3f562a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# frozen_string_literal: true

class AddUniqueIndexToProjectsName < ActiveRecord::Migration[7.2]
def change
add_index :pafs_core_projects, :name, unique: true
end
end
4 changes: 2 additions & 2 deletions spec/dummy/db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema[7.1].define(version: 2024_03_27_113556) do
ActiveRecord::Schema[7.2].define(version: 2024_09_04_104418) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"

Expand Down Expand Up @@ -328,6 +328,7 @@
t.integer "earliest_start_year"
t.string "updated_by_type"
t.bigint "updated_by_id"
t.index ["name"], name: "index_pafs_core_projects_on_name", unique: true
t.index ["reference_number", "version"], name: "index_pafs_core_projects_on_reference_number_and_version", unique: true
t.index ["slug"], name: "index_pafs_core_projects_on_slug", unique: true
t.index ["submitted_to_pol"], name: "index_pafs_core_projects_on_submitted_to_pol"
Expand Down Expand Up @@ -398,5 +399,4 @@
t.index ["reset_password_token"], name: "index_pafs_core_users_on_reset_password_token", unique: true
t.index ["unlock_token"], name: "index_pafs_core_users_on_unlock_token", unique: true
end

end

0 comments on commit f3f562a

Please sign in to comment.