Sha256: 186200452ad1e946649d7438fa03bee15dbbb5d946f8be4f463eb0402689f2a8

Contents?: true

Size: 580 Bytes

Versions: 3

Compression:

Stored size: 580 Bytes

Contents

module Rein
  # This module contains methods for creating/dropping schemas.
  module Schema
    def create_schema(*args)
      reversible do |dir|
        dir.up do _create_schema(*args) end
        dir.down { _drop_schema(*args) }
      end
    end

    def drop_schema(*args)
      reversible do |dir|
        dir.up do _drop_schema(*args) end
        dir.down { _create_schema(*args) }
      end
    end

    private

    def _create_schema(name)
      execute("CREATE SCHEMA #{name}")
    end

    def _drop_schema(name)
      execute("DROP SCHEMA #{name}")
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rein-3.5.0 lib/rein/schema.rb
rein-3.4.0 lib/rein/schema.rb
rein-3.3.0 lib/rein/schema.rb