Sha256: dfbbc4f0e6800dc0b64e7619f680f0f2a349ceed2b88b3cc98d1e6d5e9eb2b77
Contents?: true
Size: 580 Bytes
Versions: 7
Compression:
Stored size: 580 Bytes
Contents
class AddGroupLabel < ActiveRecord::Migration[6.0] class Group < ActiveRecord::Base self.table_name = :foreman_patch_groups end def up add_column :foreman_patch_groups, :label, :string Group.all.each do |group| group.label = group.name.downcase.underscore group.save! end change_column_null :foreman_patch_groups, :label, false add_index :foreman_patch_groups, :label, name: :by_label, unique: true end def down remove_index :foreman_patch_groups, name: :by_label remove_column :foreman_patch_groups, :label end end
Version data entries
7 entries across 7 versions & 1 rubygems