openstreetmap-website/db/migrate/20220223140543_remove_id_defaults.rb
Andy Allan cc99d8169f Remove default values from id columns
In both the case of primary keys, and also foreign key references,
there's no need to set a default value.

This doesn't have a big impact in routine situations, but can be
very confusing when debugging corner cases.
2022-02-23 15:22:37 +00:00

13 lines
612 B
Ruby

class RemoveIdDefaults < ActiveRecord::Migration[7.0]
def change
# Remove defaults from foreign key references
change_column_default :gpx_file_tags, :gpx_id, :from => 0, :to => nil
change_column_default :relation_members, :relation_id, :from => 0, :to => nil
change_column_default :relation_tags, :relation_id, :from => 0, :to => nil
change_column_default :way_tags, :way_id, :from => 0, :to => nil
# Remove defaults from primary keys
change_column_default :relations, :relation_id, :from => 0, :to => nil
change_column_default :ways, :way_id, :from => 0, :to => nil
end
end