Sha256: 469036ec0334465298b09a790533701e83c4b172e441ee2a82586baddc596fec

Contents?: true

Size: 733 Bytes

Versions: 6

Compression:

Stored size: 733 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: { source: Sequel[:excluded][:source] },
    }

    DB[:schema_migrations_sources].insert_conflict(**conflict_options).multi_insert(migrations)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
umbrellio-sequel-plugins-0.14.0.187 lib/tasks/sequel/archive_migrations.rake
umbrellio-sequel-plugins-0.14.0 lib/tasks/sequel/archive_migrations.rake
umbrellio-sequel-plugins-0.13.0.185 lib/tasks/sequel/archive_migrations.rake
umbrellio-sequel-plugins-0.13.0.172 lib/tasks/sequel/archive_migrations.rake
umbrellio-sequel-plugins-0.13.0 lib/tasks/sequel/archive_migrations.rake
umbrellio-sequel-plugins-0.12.0.169 lib/tasks/sequel/archive_migrations.rake