Class: CreateFeatureSubscriptions
- Inherits:
-
Object
- Object
- CreateFeatureSubscriptions
- Defined in:
- lib/generators/pin_flags/install/templates/create_feature_subscriptions.rb
Instance Method Summary collapse
Instance Method Details
#down ⇒ Object
16 17 18 19 20 21 |
# File 'lib/generators/pin_flags/install/templates/create_feature_subscriptions.rb', line 16 def down if table_exists?(:pin_flags_feature_subscriptions) remove_index :pin_flags_feature_subscriptions, name: "idx_pf_subs_on_tag_and_taggable" if index_exists?(:pin_flags_feature_subscriptions, name: "idx_pf_subs_on_tag_and_taggable") drop_table :pin_flags_feature_subscriptions end end |
#up ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/generators/pin_flags/install/templates/create_feature_subscriptions.rb', line 2 def up create_table :pin_flags_feature_subscriptions do |t| t.references :feature_tag, null: false, foreign_key: { to_table: :pin_flags_feature_tags } t.references :feature_taggable, polymorphic: true, null: false, index: false t. end add_index :pin_flags_feature_subscriptions, %i[feature_tag_id feature_taggable_type feature_taggable_id], unique: true, name: "idx_pf_subs_on_tag_and_taggable" end |