Module: Immigrate::SchemaStatements
- Included in:
- ActiveRecord::ConnectionAdapters::AbstractAdapter
- Defined in:
- lib/immigrate/schema_statements.rb
Instance Method Summary collapse
- #create_foreign_connection(foreign_server) ⇒ Object
- #create_foreign_table(foreign_table, foreign_server) {|fdw| ... } ⇒ Object
- #create_foreign_table_definition(foreign_table, foreign_server) ⇒ Object
- #drop_foreign_connection(_foreign_server) ⇒ Object
- #drop_foreign_table(foreign_table, _foreign_server = nil) ⇒ Object
Instance Method Details
#create_foreign_connection(foreign_server) ⇒ Object
3 4 5 6 7 |
# File 'lib/immigrate/schema_statements.rb', line 3 def create_foreign_connection foreign_server database.create_fdw_extension database.create_server_connection foreign_server database.create_user_mapping foreign_server end |
#create_foreign_table(foreign_table, foreign_server) {|fdw| ... } ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/immigrate/schema_statements.rb', line 13 def create_foreign_table foreign_table, foreign_server fdw = create_foreign_table_definition(foreign_table, foreign_server) yield fdw if block_given? database.execute fdw.sql end |
#create_foreign_table_definition(foreign_table, foreign_server) ⇒ Object
21 22 23 |
# File 'lib/immigrate/schema_statements.rb', line 21 def create_foreign_table_definition foreign_table, foreign_server ForeignTableDefinition.new foreign_table, foreign_server end |
#drop_foreign_connection(_foreign_server) ⇒ Object
9 10 11 |
# File 'lib/immigrate/schema_statements.rb', line 9 def drop_foreign_connection _foreign_server database.drop_fdw_extension end |
#drop_foreign_table(foreign_table, _foreign_server = nil) ⇒ Object
25 26 27 |
# File 'lib/immigrate/schema_statements.rb', line 25 def drop_foreign_table foreign_table, _foreign_server = nil database.execute "DROP FOREIGN TABLE #{foreign_table}" end |