Project

General

Profile

Feature #7667 » 0001-Add-not-null-constraints-to-lft-rgt-and-root_id-in-i.patch

Go MAEDA, 2024-01-02 06:22

View differences:

db/migrate/20240102042920_add_not_null_constraint_to_issues.rb
1
class AddNotNullConstraintToIssues < ActiveRecord::Migration[7.1]
2
  def change
3
    change_column_null :issues, :lft, false
4
    change_column_null :issues, :rgt, false
5
    change_column_null :issues, :root_id, false
6
  rescue => e
7
    # The migration may fail if there are NULL values in the columns
8
    warn "\n\n********************"
9
    warn "Migration failed.\nRunning `bin/rails r 'Issue.rebuild_tree!'` may fix the issue."
10
    warn "********************\n\n"
11
    raise
12
  end
13
end
(2-2/2)