20190713000001_group_dependent_macros.rb 490 B

123456789101112131415161718
  1. class GroupDependentMacros < ActiveRecord::Migration[4.2]
  2. def up
  3. create_table :groups_macros, id: false do |t| # rubocop:disable Rails/CreateTableWithTimestamps
  4. t.references :macro, null: false
  5. t.references :group, null: false
  6. end
  7. add_index :groups_macros, [:macro_id]
  8. add_index :groups_macros, [:group_id]
  9. add_foreign_key :groups_macros, :macros
  10. add_foreign_key :groups_macros, :groups
  11. end
  12. def self.down
  13. drop_table :groups_macros
  14. end
  15. end