lib/hanami/model/migrator/sqlite_adapter.rb in hanami-model-1.3.2 vs lib/hanami/model/migrator/sqlite_adapter.rb in hanami-model-1.3.3
- old
+ new
@@ -1,9 +1,11 @@
-require 'pathname'
-require 'hanami/utils'
-require 'English'
+# frozen_string_literal: true
+require "pathname"
+require "hanami/utils"
+require "English"
+
module Hanami
module Model
class Migrator
# SQLite3 Migrator
#
@@ -69,11 +71,11 @@
# @since 0.4.0
# @api private
def path
root.join(
- @connection.uri.sub(/\A(jdbc:sqlite:\/\/|sqlite:\/\/)/, '')
+ @connection.uri.sub(/\A(jdbc:sqlite:\/\/|sqlite:\/\/)/, "")
)
end
# @since 0.4.0
# @api private
@@ -102,27 +104,23 @@
end
# @since 0.4.0
# @api private
#
- # rubocop:disable Metrics/AbcSize
- # rubocop:disable Metrics/MethodLength
def dump_migrations_data
execute "sqlite3 #{escape(path)} .dump" do |stdout|
begin
contents = stdout.read.split($INPUT_RECORD_SEPARATOR)
- contents = contents.grep(/^INSERT INTO "#{migrations_table}"/)
+ contents = contents.grep(/^INSERT INTO "?#{migrations_table}"?/)
::File.open(schema, ::File::CREAT | ::File::BINARY | ::File::WRONLY | ::File::APPEND) do |file|
file.write(contents.join($INPUT_RECORD_SEPARATOR))
end
rescue => exception
raise MigrationError.new(exception.message)
end
end
end
- # rubocop:enable Metrics/MethodLength
- # rubocop:enable Metrics/AbcSize
end
end
end
end