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 | ||
|---|---|---|
| 1 |
class AddNotNullConstraintToProjects < ActiveRecord::Migration[7.1] |
|
| 2 |
def change |
|
| 3 |
change_column_null :projects, :lft, false |
|
| 4 |
change_column_null :projects, :rgt, false |
|
| 5 |
rescue => e |
|
| 6 |
# The migration may fail if there are NULL values in the columns |
|
| 7 |
warn "\n\n********************" |
|
| 8 |
warn "Migration failed.\nRunning `bin/rails r 'Project.rebuild_tree!'` may fix the issue." |
|
| 9 |
warn "********************\n\n" |
|
| 10 |
raise |
|
| 11 |
end |
|
| 12 |
end |
|