Files
simple-aircraft-manager-rails/db/migrate/20261108000000_create_logbook_entry_parts.rb
T
rickyandClaude Opus 5.5 7caa213e7a Sub-components on logbook entries (e.g. the oil filter on the engine)
- Once a component is chosen, its sub-components are offered on the entry
  form (and the squawk Resolve page); ticked ones are saved with their
  total time and time since service, worked out from the airframe total
  time like the component's (editable; blank before it was installed)
- Entry page and printed PDFs list each sub-component with its serial
  number and times; parts without an overhaul type read "Since service"
- Archives carry them: the original format's list of components per entry
  (first = the entry's component, the rest = sub-components)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-07 12:54:49 -05:00

15 lines
642 B
Ruby

# Sub-components a logbook entry also covers (e.g. the oil filter on the
# engine), with their times at the entry.
class CreateLogbookEntryParts < ActiveRecord::Migration[8.1]
def change
create_table :logbook_entry_parts do |t|
t.references :logbook_entry, null: false, foreign_key: { on_delete: :cascade }
t.references :component, null: false, foreign_key: { on_delete: :cascade }
t.decimal :hours_at_entry, precision: 8, scale: 1
t.decimal :since_overhaul_at_entry, precision: 8, scale: 1
t.timestamps
end
add_index :logbook_entry_parts, %i[logbook_entry_id component_id], unique: true
end
end