Class: PGAssets::PGConstraint

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
LoadableAsset
Defined in:
lib/pg_assets/models/pg_constraint.rb

Instance Method Summary collapse

Instance Method Details

#identityObject



17
18
19
# File 'lib/pg_assets/models/pg_constraint.rb', line 17

def identity
  "#{conname} on #{get_table_name}"
end

#sql_for_reinstallObject



25
26
27
# File 'lib/pg_assets/models/pg_constraint.rb', line 25

def sql_for_reinstall
  sql = "#{sql_for_remove}; ALTER TABLE #{get_table_name} ADD CONSTRAINT #{conname} #{cached_defn}"
end

#sql_for_removeObject



21
22
23
# File 'lib/pg_assets/models/pg_constraint.rb', line 21

def sql_for_remove
  sql = "ALTER TABLE #{get_table_name} DROP CONSTRAINT IF EXISTS #{conname}"
end