Skip to content

Commit

Permalink
Added migration
Browse files Browse the repository at this point in the history
  • Loading branch information
KseniaGovorun committed Nov 30, 2024
1 parent eb0492d commit 06ed92a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class AddUniqueIndexToUkNameAndEnName < ActiveRecord::Migration[7.2]
def change
add_index :categories, :uk_name, unique: true
add_index :categories, :en_name, unique: true
end
end
4 changes: 3 additions & 1 deletion 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.2].define(version: 2024_11_19_192344) do
ActiveRecord::Schema[7.2].define(version: 2024_11_30_191031) do
# These are extensions that must be enabled in order to support this database
enable_extension "pgcrypto"
enable_extension "plpgsql"
Expand Down Expand Up @@ -61,7 +61,9 @@
t.decimal "price", precision: 10, scale: 2, default: "0.0", null: false
t.bigint "field_id"
t.boolean "preferable", default: false, null: false
t.index ["en_name"], name: "index_categories_on_en_name", unique: true
t.index ["field_id"], name: "index_categories_on_field_id"
t.index ["uk_name"], name: "index_categories_on_uk_name", unique: true
end

create_table "category_categoryables", force: :cascade do |t|
Expand Down

0 comments on commit 06ed92a

Please sign in to comment.