Sha256: 7ce9e96c8504bafc0668a2547a8312adf905579d96061158c753781edfe83451

Contents?: true

Size: 843 Bytes

Versions: 2

Compression:

Stored size: 843 Bytes

Contents

# frozen_string_literal: true

require "ts_schema/version"
require "ts_schema/railtie"

require "ts_schema/configuration"
require "ts_schema/schema_generator"

module TsSchema
  class << self
    def setup(&block)
      configuration.assign(&block)
    end

    def configuration
      @configuration ||= Configuration.new
    end

    def generate
      if ActiveRecord::Base.connection.migration_context.needs_migration?
        puts "Aborting: There are pending migrations"
      else
        SchemaGenerator.new(@configuration).generate
      end
    end

    def output_file
      if ActiveRecord::Base.connection.migration_context.needs_migration?
        puts "Aborting: There are pending migrations"
      else
        SchemaGenerator.new(@configuration).output_file
      end
    end
  end
end

require "generators/install_generator"

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ts_schema-1.0.1 lib/ts_schema.rb
ts_schema-1.0.0 lib/ts_schema.rb