turn constants into class vars, fixes #1767
git-svn-id: file:///home/svn/framework3/trunk@9172 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
8923de2d8d
commit
16cd48e4dc
|
@ -3,24 +3,24 @@
|
||||||
#
|
#
|
||||||
class AddTimestamps < ActiveRecord::Migration
|
class AddTimestamps < ActiveRecord::Migration
|
||||||
|
|
||||||
TABLES_NEEDING_RENAME = [:clients, :hosts, :notes, :refs, :services, :vulns, :wmap_requests]
|
@@TABLES_NEEDING_RENAME = [:clients, :hosts, :notes, :refs, :services, :vulns, :wmap_requests]
|
||||||
TABLES_NEEDING_CREATED_AT = [:wmap_targets]
|
@@TABLES_NEEDING_CREATED_AT = [:wmap_targets]
|
||||||
TABLES_NEEDING_UPDATED_AT = [:clients, :events, :hosts, :notes, :refs, :services, :vulns, :wmap_requests, :wmap_targets]
|
@@TABLES_NEEDING_UPDATED_AT = [:clients, :events, :hosts, :notes, :refs, :services, :vulns, :wmap_requests, :wmap_targets]
|
||||||
|
|
||||||
def self.up
|
def self.up
|
||||||
TABLES_NEEDING_RENAME.each { |t| rename_column t, :created, :created_at }
|
@@TABLES_NEEDING_RENAME.each { |t| rename_column t, :created, :created_at }
|
||||||
|
|
||||||
TABLES_NEEDING_CREATED_AT.each { |t| add_column t, :created_at, :datetime }
|
@@TABLES_NEEDING_CREATED_AT.each { |t| add_column t, :created_at, :datetime }
|
||||||
|
|
||||||
TABLES_NEEDING_UPDATED_AT.each { |t| add_column t, :updated_at, :datetime }
|
@@TABLES_NEEDING_UPDATED_AT.each { |t| add_column t, :updated_at, :datetime }
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.down
|
def self.down
|
||||||
TABLES_NEEDING_RENAME.each { |t| rename_column t, :created_at, :created }
|
@@TABLES_NEEDING_RENAME.each { |t| rename_column t, :created_at, :created }
|
||||||
|
|
||||||
TABLES_NEEDING_CREATED_AT.each { |t| remove_column t, :created_at }
|
@@TABLES_NEEDING_CREATED_AT.each { |t| remove_column t, :created_at }
|
||||||
|
|
||||||
TABLES_NEEDING_UPDATED_AT.each { |t| remove_column t, :updated_at }
|
@@TABLES_NEEDING_UPDATED_AT.each { |t| remove_column t, :updated_at }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue