Feature #7667 » 0002-Add-not-null-constraints-to-lft-and-rgt-in-issues-ta.patch
| db/migrate/20240102042936_add_not_null_constraint_to_projects.rb | ||
|---|---|---|
|
class AddNotNullConstraintToProjects < ActiveRecord::Migration[7.1]
|
||
|
def change
|
||
|
change_column_null :projects, :lft, false
|
||
|
change_column_null :projects, :rgt, false
|
||
|
rescue => e
|
||
|
# The migration may fail if there are NULL values in the columns
|
||
|
warn "\n\n********************"
|
||
|
warn "Migration failed.\nRunning `bin/rails r 'Project.rebuild_tree!'` may fix the issue."
|
||
|
warn "********************\n\n"
|
||
|
raise
|
||
|
end
|
||
|
end
|
||