diff options
author | Yorick Peterse <yorickpeterse@gmail.com> | 2016-10-27 14:36:53 +0200 |
---|---|---|
committer | Yorick Peterse <yorickpeterse@gmail.com> | 2016-10-31 12:54:48 +0100 |
commit | 83c8241160ed48ab066e2c5bd58d0914a745197c (patch) | |
tree | bb552937e6d4861394a7fb5e67e5fce5613edea1 /lib | |
parent | 696f09c7bf15c090c46a7d9abe14e0c769576db2 (diff) | |
download | gitlab-ce-83c8241160ed48ab066e2c5bd58d0914a745197c.tar.gz |
Support for post deployment migrationsbackground-migrations
These are regular Rails migrations that are executed by default. A user
can opt-out of these migrations by setting an environment variable
during the deployment process.
Fixes gitlab-org/gitlab-ce#22133
Diffstat (limited to 'lib')
-rw-r--r-- | lib/generators/rails/post_deployment_migration/post_deployment_migration_generator.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/generators/rails/post_deployment_migration/post_deployment_migration_generator.rb b/lib/generators/rails/post_deployment_migration/post_deployment_migration_generator.rb new file mode 100644 index 00000000000..392bd640192 --- /dev/null +++ b/lib/generators/rails/post_deployment_migration/post_deployment_migration_generator.rb @@ -0,0 +1,13 @@ +module Rails + class PostDeploymentMigrationGenerator < Rails::Generators::NamedBase + def create_migration_file + timestamp = Time.now.strftime('%Y%m%d%H%I%S') + + template "migration.rb", "db/post_migrate/#{timestamp}_#{file_name}.rb" + end + + def migration_class_name + file_name.camelize + end + end +end |