Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated github action; switch to ruby 3.2 #279

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/gempush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:

steps:
- uses: actions/checkout@master
- name: Set up Ruby 2.6
uses: actions/setup-ruby@v1
- name: Set up Ruby 3.x
uses: ruby/setup-ruby@v1
with:
version: 2.6.x
version: 3.2.x

- name: Publish to RubyGems
run: |
Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.6.1
3.2.2
50 changes: 18 additions & 32 deletions tasks/databases.rake
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,7 @@ namespace :db do
end

migrations.each do |migration|
if migration[:kind] == :data
ActiveRecord::Migration.write("== %s %s" % ['Data', "=" * 71])
DataMigrate::DataMigrator.run(migration[:direction], data_migrations_path, migration[:version])
else
ActiveRecord::Migration.write("== %s %s" % ['Schema', "=" * 69])
DataMigrate::SchemaMigration.run(
migration[:direction],
Rails.application.config.paths["db/migrate"],
migration[:version]
)
end
run_migration(migration, migration[:direction])
end

Rake::Task["db:_dump"].invoke
Expand Down Expand Up @@ -91,13 +81,7 @@ namespace :db do
end

migrations.each do |migration|
if migration[:kind] == :data
ActiveRecord::Migration.write("== %s %s" % ['Data', "=" * 71])
DataMigrate::DataMigrator.run(:up, data_migrations_path, migration[:version])
else
ActiveRecord::Migration.write("== %s %s" % ['Schema', "=" * 69])
DataMigrate::SchemaMigration.run(:up, "db/migrate/", migration[:version])
end
run_migration(migration, :up)
end

Rake::Task["db:_dump"].invoke
Expand All @@ -119,13 +103,7 @@ namespace :db do
end

migrations.each do |migration|
if migration[:kind] == :data
ActiveRecord::Migration.write("== %s %s" % ['Data', "=" * 71])
DataMigrate::DataMigrator.run(:down, data_migrations_path, migration[:version])
else
ActiveRecord::Migration.write("== %s %s" % ['Schema', "=" * 69])
DataMigrate::SchemaMigration.run(:down, "db/migrate/", migration[:version])
end
run_migration(migration, :down)
end

Rake::Task["db:_dump"].invoke
Expand Down Expand Up @@ -189,13 +167,7 @@ namespace :db do
step = ENV['STEP'] ? ENV['STEP'].to_i : 1
assure_data_schema_table
past_migrations[0..(step - 1)].each do | past_migration |
if past_migration[:kind] == :data
ActiveRecord::Migration.write("== %s %s" % ['Data', "=" * 71])
DataMigrate::DataMigrator.run(:down, data_migrations_path, past_migration[:version])
elsif past_migration[:kind] == :schema
ActiveRecord::Migration.write("== %s %s" % ['Schema', "=" * 69])
DataMigrate::SchemaMigration.run(:down, "db/migrate/", past_migration[:version])
end
run_migration(past_migration, :down)
end

Rake::Task["db:_dump"].invoke
Expand Down Expand Up @@ -412,3 +384,17 @@ end
def data_migrations_path
DataMigrate.config.data_migrations_path
end

def run_migration(migration, direction)
if migration[:kind] == :data
ActiveRecord::Migration.write("== %s %s" % ['Data', "=" * 71])
DataMigrate::DataMigrator.run(direction, data_migrations_path, migration[:version])
else
ActiveRecord::Migration.write("== %s %s" % ['Schema', "=" * 69])
DataMigrate::SchemaMigration.run(
direction,
DataMigrate::SchemaMigration.migrations_paths,
migration[:version]
)
end
end