1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-11-29 10:24:20 +01:00
fab-manager/db/migrate/20230302120458_add_uniqueness_constraints.rb
Sylvain 6ae8c965f3 (quality) add unique constraints in db
Also: code lint in SSO models
2023-03-02 13:26:05 +01:00

13 lines
582 B
Ruby

# frozen_string_literal: true
# Add uniqueness constraint at database level
class AddUniquenessConstraints < ActiveRecord::Migration[5.2]
def change
add_index :credits, %i[plan_id creditable_id creditable_type], unique: true
add_index :prices, %i[plan_id priceable_id priceable_type group_id duration], unique: true,
name: 'index_prices_on_plan_priceable_group_and_duration'
add_index :price_categories, :name, unique: true
add_index :auth_providers, :name, unique: true
end
end