Skip to content

Commit

Permalink
v6.5
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonfb committed Jan 11, 2022
1 parent 5906300 commit ea0b5ea
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ _Please use the version number of this gem in lockstep with your Rails version._
| Rails 5.2 | | v4.0.2 (Released Jun 2, 2019) | |
| Rails 6.0 | | v5.1.2.1 (Released Nov 17, 2021) | |
| Rails 7.0.0.alpha2 | | v6.0.alpha2 (Released Nov 17, 2021) | |
| Rails 7 | | v6.5 (Released Jan 11, 2022) | |


## Introduction

Nonschema migrations, also known as data migrations, are a alternative kind of Rails migration. The data migrations operate exactly like schema migrations, except instead of running migrations to make changes to your schema (adding fields, dropping fields, adding tables, etc), you run data migrations to manipulate data in your app, enqueue or execute Resque jobs that require long-running processes. This happens in a Rails app for different reasons, usually to clean up or supplement data or architectural changes.

Splitting your data migrations from your schema migrations has a particular benefit of achieving the most consistent zero-downtime deploys you can. I recommend you switch your deployment script to allow you to do two types of deploys: a Zero-downtime deploy (no schema migrations) and Schema Migration deploy.
Splitting your data migrations from your schema migrations has a particular benefit of achieving the most consistent zero-downtime deploys you can. I recommend you switch your deployment script to allow you to do two
types of deploys: a Zero-downtime deploy (no schema migrations) and Schema Migration deploy.

You can think of data migrations like seed data for production, staging, and dev environments. It is for people who don't like using seed data in dev, and want to have 'seed-parity' between dev + prod. (For example, for a basic set of setup records.)

This way, you can deploy any non-destructive (data-only) migration with a Zero-downtime strategy, and opt to make destructive (schema) migrations in a normal deployment (maintenance on, run schema changes, boot up new app, maintenance off). Data-only migrations can be run while the app is actually running, augmenting what you can achieve with the migration-style shortcuts provided by Rails.

Expand Down
34 changes: 20 additions & 14 deletions nonschema_migrations.gemspec
Original file line number Diff line number Diff line change
@@ -1,31 +1,37 @@
require "./lib/nonschema_migrations/version"

Gem::Specification.new do |s|
s.name = 'nonschema_migrations'
s.version = NonSchemaMigrations::VERSION
s.date = Time.now.strftime("%Y-%m-%d")
s.summary = "Nonschema(data-only) migrations for your Rails app"
s.description = "Separate schema-only migrations from nonschema (data) migrations in your Rails app"
s.authors = ["Jason Fleetwood-Boldt"]
s.email = 'code@jasonfb.net'
Gem::Specification.new do |spec|
spec.name = 'nonschema_migrations'
spec.version = NonSchemaMigrations::VERSION
spec.date = Time.now.strftime("%Y-%m-%d")
spec.summary = "Nonschema(data-only) migrations for your Rails app"
spec.description = "Separate schema-only migrations from nonschema (data) migrations in your Rails app"
spec.authors = ["Jason Fleetwood-Boldt"]
spec.email = 'code@jasonfb.net'


spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)}) || f.match(%r{(gemspec|gem)$}) }
files
end
s.homepage = 'https://github.com/jasonfb/nonschema_migrations'

s.metadata = { "source_code_uri" => "https://github.com/jasonfb/nonschema_migrations",
spec.homepage = 'https://github.com/jasonfb/nonschema_migrations'

spec.metadata = { "source_code_uri" => "https://github.com/jasonfb/nonschema_migrations",
"documentation_uri" => "https://jasonfleetwoodboldt.com/my-open-source-projects/nonschema-migrations/",
"homepage_uri" => 'https://heliosdev.shop/'}

s.license = 'MIT'
s.post_install_message = <<~MSG
spec.license = 'MIT'
spec.post_install_message = <<~MSG
---------------------------------------------
Welcome to Nonschema Migrations
to set up, please run
1. run set up data migrations:
rails generate data_migrations:install
2. to create a data migration use
rails generate data_migration SetupExampleData
You can think of data migrations like seed data for production, staging, and dev environments.
For support please see https://heliosdev.shop/
---------------------------------------------
Expand Down

0 comments on commit ea0b5ea

Please sign in to comment.