Class: Baza::Driver::Pg::ForeignKey
- Inherits:
-
ForeignKey
- Object
- ForeignKey
- Baza::Driver::Pg::ForeignKey
- Defined in:
- lib/baza/driver/pg/foreign_key.rb
Instance Attribute Summary
Attributes inherited from ForeignKey
#column_name, #db, #name, #referenced_column_name, #referenced_table_name, #table_name
Instance Method Summary collapse
- #drop ⇒ Object
-
#initialize(args) ⇒ ForeignKey
constructor
A new instance of ForeignKey.
Methods inherited from ForeignKey
Methods included from Baza::DatabaseModelFunctionality
Constructor Details
#initialize(args) ⇒ ForeignKey
Returns a new instance of ForeignKey.
2 3 4 5 6 7 8 9 10 11 12 |
# File 'lib/baza/driver/pg/foreign_key.rb', line 2 def initialize(args) @db = args.fetch(:db) data = args.fetch(:data) @column_name = data.fetch(:column_name) @name = data.fetch(:constraint_name) @table_name = data.fetch(:table_name) @referenced_column_name = data.fetch(:foreign_column_name) @referenced_table_name = data.fetch(:foreign_table_name) end |
Instance Method Details
#drop ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/baza/driver/pg/foreign_key.rb', line 14 def drop @db.query(" ALTER TABLE #{@db.quote_table(table_name)} DROP CONSTRAINT #{@db.quote_table(name)} ") true end |