lib/rom/sql/migration/migrator.rb in rom-sql-3.6.4 vs lib/rom/sql/migration/migrator.rb in rom-sql-4.0.0.alpha1

- old
+ new

@@ -1,25 +1,25 @@ # frozen_string_literal: true -require 'pathname' +require "pathname" -require 'rom/types' -require 'rom/initializer' +require "rom/types" +require "rom/initializer" -require 'rom/sql/migration/runner' -require 'rom/sql/migration/inline_runner' -require 'rom/sql/migration/writer' +require "rom/sql/migration/runner" +require "rom/sql/migration/inline_runner" +require "rom/sql/migration/writer" module ROM module SQL module Migration # @api private class Migrator extend Initializer - DEFAULT_PATH = 'db/migrate'.freeze - VERSION_FORMAT = '%Y%m%d%H%M%S'.freeze + DEFAULT_PATH = "db/migrate" + VERSION_FORMAT = "%Y%m%d%H%M%S" DEFAULT_INFERRER = Schema::Inferrer.new.suppress_errors.freeze param :connection option :path, type: ROM::Types.Nominal(Pathname), default: -> { DEFAULT_PATH } @@ -41,12 +41,12 @@ Sequel.migration(&block) end # @api private def create_file(name, version = generate_version, **options) - sequence = options[:sequence] ? '%03d' % options[:sequence] : nil - filename = "#{ version }#{ sequence }_#{ name }.rb" + sequence = options[:sequence] ? "%03d" % options[:sequence] : nil + filename = "#{version}#{sequence}_#{name}.rb" content = options[:content] || migration_file_content path = options[:path] || self.path dirname = Pathname(path) fullpath = dirname.join(filename) @@ -61,10 +61,10 @@ Time.now.utc.strftime(VERSION_FORMAT) end # @api private def migration_file_content - File.read(Pathname(__FILE__).dirname.join('template.rb').realpath) + File.read(Pathname(__FILE__).dirname.join("template.rb").realpath) end # @api private def auto_migrate!(gateway, schemas, options = EMPTY_HASH) diff_finder = SchemaDiff.new(gateway.database_type)