module Schemaless::Worker

Do the twist!

Public Class Methods

all_tables() click to toggle source

Work!

# File lib/schemaless/worker.rb, line 30
def all_tables # (models)
  tables = []
  models = ::ActiveRecord::Base.descendants
  # fail 'No models...eager load off?' if models.empty?
  models.each do |model|
    next if model.to_s =~ /ActiveRecord::/
    model.reset_column_information
    tables << ::Schemaless::Table.new(model)
  end
  tables
end
generate!() click to toggle source

Run Schemaless migrations

::Rails::Generators

.invoke('schemaless:migration', data, file_name: 'fu',
        behavior: :invoke, destination_root: Rails.root)
# File lib/schemaless/worker.rb, line 22
def generate!
  ::ActiveRecord::Base.establish_connection 'production'
  Schemaless::MigrationsGenerator.new(all_tables).invoke_all
end
run!() click to toggle source

Run Schemaless live mode

# File lib/schemaless/worker.rb, line 11
def run!
  # ::Rails.application.eager_load!
  all_tables.each(&:run!)
end