Files
velour/db/migrate/20251029120404_update_videos_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

30 lines
987 B
Ruby

class UpdateVideosFromArchitecture < ActiveRecord::Migration[8.1]
def change
change_table :videos do |t|
# Make work reference optional (videos can exist without works initially)
t.change_null :work_id, true
# Add defaults for boolean fields
t.change_default :imported, false
t.change_default :processing_failed, false
t.change_default :has_subtitles, false
# Note: file_size is already integer, SQLite compatible with bigint
# Add source_type default and make required fields not null
t.change_default :source_type, 0
t.change_null :source_type, false
# Make file_path required
t.change_null :file_path, false
end
# Add indexes as specified in architecture
add_index :videos, [:storage_location_id, :file_path], unique: true
add_index :videos, :source_type
add_index :videos, :file_hash
add_index :videos, :imported
add_index :videos, [:work_id, :resolution_label]
end
end