Sha256: 33b78ab1d35ffabe95de2c61c499073c411c8262263b551bb12fb456254516e1
Contents?: true
Size: 1 KB
Versions: 7
Compression:
Stored size: 1 KB
Contents
class ExtendLabel < ActiveRecord::Migration FIELDS = [ {'rev' => {type: :integer, options: {default: 1}}}, {'published_version_id' => {type: :integer}}, {'published_at' => {type: :date}}, {'locked_by' => {type: :integer}}, {'expired_at' => {type: :date}}, {'follow_up' => {type: :date}}, {'to_review' => {type: :boolean}}, {'rdf_updated_at' => {type: :date}} ] def self.up FIELDS.each do |hsh| hsh.each do |column_name, hsh2| unless column_exists?(:labels, column_name) add_column(:labels, column_name, hsh2[:type], (hsh2[:options] || {})) end end end add_index :labels, 'published_version_id', name: 'ix_labels_on_published_v' unless index_exists?(:labels, 'published_version_id', name: 'ix_labels_on_published_v') end def self.down FIELDS.each do |hsh| hsh.each do |column_name, hsh2| if column_exists?(:labels, column_name) remove_column(:labels, column_name) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems