Files
simple-aircraft-manager-rails/db/migrate/20261107250000_create_logbook_templates.rb
rickyandClaude Opus 5.5 72e1d7760f Editable logbook templates; component times follow the airframe time
- Templates move to the database (Admin -> Logbook templates: add, edit,
  delete, restore the built-in ones). The built-in preventive maintenance
  set is added once on first use; deletions stick. A template can set the
  entry type, logbook (picking the matching component) and certificate
- Template list shows "Name — Part 43 App. A (c)(6), (c)(23)" instead of
  the doubled parentheses
- Component total time and time since overhaul are worked out from the
  entry's airframe total time (current times shifted by the difference);
  blank when the entry predates the overhaul; typing them stops the
  automatic updates

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

17 lines
573 B
Ruby

# Logbook entry templates admins can add and edit (the built-in preventive
# maintenance set is added on first use; see LogbookTemplate.ensure_defaults!).
class CreateLogbookTemplates < ActiveRecord::Migration[8.1]
def change
create_table :logbook_templates do |t|
t.string :name, null: false
t.string :reference
t.text :text, null: false
t.string :entry_type, null: false, default: "MAINTENANCE"
t.string :log_type
t.string :certificate_type
t.integer :position, null: false, default: 0
t.timestamps
end
end
end