Sha256: 4984c2f6a100d219e4786220b427e8862529a5f3f677a184d8805fcc032d2e02
Contents?: true
Size: 773 Bytes
Versions: 12
Compression:
Stored size: 773 Bytes
Contents
# frozen_string_literal: true namespace :sequel do desc "Archive migrations source code" task archive_migrations: :environment do DB.create_table?(:schema_migrations_sources) do column :version, "numeric", primary_key: true column :filename, "text", null: false column :source, "text", null: false end migrations = Rails.root.glob("db/migrate/*.rb").map do |file| filename = file.basename.to_s { version: filename.to_i, filename: filename, source: file.read } end conflict_options = { target: :version, update: { filename: Sequel[:excluded][:filename], source: Sequel[:excluded][:source] }, } DB[:schema_migrations_sources].insert_conflict(**conflict_options).multi_insert(migrations) end end
Version data entries
12 entries across 12 versions & 1 rubygems