20240111033014_create_generated_annual_reports.rb 509 B

1234567891011121314151617
  1. # frozen_string_literal: true
  2. class CreateGeneratedAnnualReports < ActiveRecord::Migration[7.1]
  3. def change
  4. create_table :generated_annual_reports do |t|
  5. t.belongs_to :account, null: false, foreign_key: { on_cascade: :delete }, index: false
  6. t.integer :year, null: false
  7. t.jsonb :data, null: false
  8. t.integer :schema_version, null: false
  9. t.datetime :viewed_at
  10. t.timestamps
  11. end
  12. add_index :generated_annual_reports, [:account_id, :year], unique: true
  13. end
  14. end