Files
velour/db/migrate/20251029120434_update_storage_locations_from_architecture.rb
Dan Milne 88a906064f
Some checks failed
CI / scan_ruby (push) Has been cancelled
CI / scan_js (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / test (push) Has been cancelled
CI / system-test (push) Has been cancelled
Much base work started
2025-10-31 14:36:14 +11:00

25 lines
805 B
Ruby

class UpdateStorageLocationsFromArchitecture < ActiveRecord::Migration[8.1]
def change
change_table :storage_locations do |t|
# Add defaults for boolean fields
t.change_default :writable, false
t.change_default :enabled, true
t.change_default :scan_subdirectories, true
t.change_default :priority, 0
# Add location_type default and make required fields not null
t.change_default :location_type, 0
t.change_null :location_type, false
# Make name required
t.change_null :name, false
end
# Add indexes as specified in architecture
add_index :storage_locations, :name, unique: true
add_index :storage_locations, :location_type
add_index :storage_locations, :enabled
add_index :storage_locations, :priority
end
end