Module: QueSchema::MigrationHelpers
- Defined in:
- lib/que_schema/migration_helpers.rb
Overview
Convenience methods for migrations when setting up Que via ActiveRecord.
Instance Method Summary collapse
-
#create_que_schema(version:) ⇒ Object
Creates the Que schema for the given version.
-
#drop_que_schema ⇒ Object
Drops the entire Que schema by migrating down to version 0.
Instance Method Details
#create_que_schema(version:) ⇒ Object
Creates the Que schema for the given version. Delegates to Que.migrate! which handles everything.
10 11 12 |
# File 'lib/que_schema/migration_helpers.rb', line 10 def create_que_schema(version:) que_define_schema(version: version) end |
#drop_que_schema ⇒ Object
Drops the entire Que schema by migrating down to version 0. Removes all Que tables, functions, and triggers.
16 17 18 19 20 21 |
# File 'lib/que_schema/migration_helpers.rb', line 16 def drop_que_schema return unless connection.adapter_name.match?(/postgresql/i) Que.connection_proc = proc { |&block| block.call(connection.raw_connection) } Que.migrate!(version: 0) end |