Sha256: b7adc70b4cc7c0dd30a092872804afb0b2ba79002035100ba8c0793dc10a25c4

Contents?: true

Size: 1010 Bytes

Versions: 1

Compression:

Stored size: 1010 Bytes

Contents

require "fx/version"
require "fx/adapters/postgres"
require "fx/command_recorder"
require "fx/configuration"
require "fx/definition"
require "fx/function"
require "fx/statements"
require "fx/schema_dumper"
require "fx/trigger"
require "fx/railtie"

# F(x) adds methods `ActiveRecord::Migration` to create and manage database
# triggers and functions in Rails applications.
module Fx
  # Hooks Fx into Rails.
  #
  # Enables fx migration methods, migration reversability, and `schema.rb`
  # dumping.
  def self.load
    ActiveRecord::Migration::CommandRecorder.send(
      :include,
      Fx::CommandRecorder
    )

    ActiveRecord::SchemaDumper.send(
      :prepend,
      Fx::SchemaDumper
    )

    ActiveRecord::ConnectionAdapters::AbstractAdapter.send(
      :include,
      Fx::Statements
    )
  end

  # The current database adapter used by F(x).
  #
  # This defaults to {Fx::Adapters::Postgres} but can be overridden
  # via {Configuration}.
  def self.database
    configuration.database
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fx-0.8.0 lib/fx.rb