Sha256: 7b7bd4295469e6ebebb8fac3a9d9a654c971d92e5176706176613f46db17051b
Contents?: true
Size: 901 Bytes
Versions: 4
Compression:
Stored size: 901 Bytes
Contents
module DataMapper module Constraints module MysqlAdapter module SQL include DataMapper::Constraints::DataObjectsAdapter::SQL private def destroy_constraints_statement(table_name, constraint_name) <<-EOS.compress_lines ALTER TABLE #{quote_table_name(table_name)} DROP FOREIGN KEY #{quote_constraint_name(constraint_name)} EOS end def constraint_exists?(storage_name, constraint_name) statement = <<-EOS.compress_lines SELECT COUNT(*) FROM `information_schema`.`table_constraints` WHERE `constraint_type` = 'FOREIGN KEY' AND `table_schema` = ? AND `table_name` = ? AND `constraint_name` = ? EOS query(statement, db_name, storage_name, constraint_name).first > 0 end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems