Feature: JH db migrations

More details: https://gitlab.com/gitlab-jh/gitlab/-/issues/161

Goals

Generator

bundle exec rails g migration create_jh_only
  • Created jh/db/migrate/20210826052352_create_jh_only.rb

Migration

bundle exec rails db:migrate
  • Created jh/db/schema_migrations/20210826052352
  • Updated jh/db/structure.sql

CE/EE upgrade to JH

  • Upgrade from a version before 13.10.0
  • Upgrade from a version after 13.10.0 ⚠️

Rails source code reference

https://github.com/rails/rails/blob/6-1-stable/activerecord/lib/active_record/tasks/database_tasks.rb#L82-L88

https://github.com/rails/rails/blob/6-1-stable/activerecord/lib/active_record/migration.rb#L1217

https://github.com/rails/rails/blob/6-1-stable/activerecord/lib/rails/generators/active_record/migration.rb

https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/engine/configuration.rb#L64-L66

https://github.com/rails/rails/blob/6-1-stable/activerecord/lib/active_record/railtie.rb#L38-L50

https://github.com/rails/rails/blob/6-1-stable/railties/lib/rails/generators/migration.rb#L56-L74

https://github.com/rails/rails/blob/6-1-stable/activerecord/lib/active_record/railties/databases.rake#L687-L689

Background Information

Issue: Reduce conflicts in database schema

Issue: Conflict-free schema version handling

由 Qian Zhang (Gary) 编辑于 9月 06, 2021
指派人 加载中
工时统计 加载中
关于极狐(GitLab)
违法和不良信息举报中心 京公网安备11010502047940号 京ICP备2021036779号-1