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

Version Path
umbrellio-sequel-plugins-0.16.1 lib/tasks/sequel/archive_migrations.rake
umbrellio-sequel-plugins-0.16.0.239 lib/tasks/sequel/archive_migrations.rake
umbrellio-sequel-plugins-0.16.0.238 lib/tasks/sequel/archive_migrations.rake
umbrellio-sequel-plugins-0.16.0.235 lib/tasks/sequel/archive_migrations.rake
umbrellio-sequel-plugins-0.16.0.234 lib/tasks/sequel/archive_migrations.rake
umbrellio-sequel-plugins-0.16.0.233 lib/tasks/sequel/archive_migrations.rake
umbrellio-sequel-plugins-0.16.0 lib/tasks/sequel/archive_migrations.rake
umbrellio-sequel-plugins-0.16.0.211 lib/tasks/sequel/archive_migrations.rake
umbrellio-sequel-plugins-0.15.0.198 lib/tasks/sequel/archive_migrations.rake
umbrellio-sequel-plugins-0.14.0.192 lib/tasks/sequel/archive_migrations.rake
umbrellio-sequel-plugins-0.14.0.189 lib/tasks/sequel/archive_migrations.rake
umbrellio-sequel-plugins-0.14.0.188 lib/tasks/sequel/archive_migrations.rake