Does table exist
def self.table_exists?(name)
ActiveRecord::Base.connection.tables.include?(name)
end
Does column exist
if table_exists?(:profile) && !TableName.column_names.include?("url")
add_column :profile, :url, :string
end
def self.table_exists?(name)
ActiveRecord::Base.connection.tables.include?(name)
end
if table_exists?(:profile) && !TableName.column_names.include?("url")
add_column :profile, :url, :string
end