lib/ts_schema.rb in ts_schema-0.1.10 vs lib/ts_schema.rb in ts_schema-0.1.11
- old
+ new
@@ -2,10 +2,11 @@
require "ts_schema/railtie"
require "ts_schema/configuration"
require "ts_schema/schema_generator"
+
module TsSchema
class << self
def setup(&block)
configuration.assign(&block)
end
@@ -13,14 +14,22 @@
def configuration
@configuration ||= Configuration.new
end
def generate
- SchemaGenerator.new.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
- SchemaGenerator.new.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"