Add annual reports for accounts (#28693)
This commit is contained in:
parent
01ce9df880
commit
5b1eb09d54
21 changed files with 480 additions and 1 deletions
17
db/migrate/20240111033014_create_generated_annual_reports.rb
Normal file
17
db/migrate/20240111033014_create_generated_annual_reports.rb
Normal file
|
@ -0,0 +1,17 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class CreateGeneratedAnnualReports < ActiveRecord::Migration[7.1]
|
||||
def change
|
||||
create_table :generated_annual_reports do |t|
|
||||
t.belongs_to :account, null: false, foreign_key: { on_cascade: :delete }, index: false
|
||||
t.integer :year, null: false
|
||||
t.jsonb :data, null: false
|
||||
t.integer :schema_version, null: false
|
||||
t.datetime :viewed_at
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :generated_annual_reports, [:account_id, :year], unique: true
|
||||
end
|
||||
end
|
14
db/schema.rb
14
db/schema.rb
|
@ -10,7 +10,7 @@
|
|||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_01_09_103012) do
|
||||
ActiveRecord::Schema[7.1].define(version: 2024_01_11_033014) do
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
||||
|
@ -516,6 +516,17 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_09_103012) do
|
|||
t.index ["target_account_id"], name: "index_follows_on_target_account_id"
|
||||
end
|
||||
|
||||
create_table "generated_annual_reports", force: :cascade do |t|
|
||||
t.bigint "account_id", null: false
|
||||
t.integer "year", null: false
|
||||
t.jsonb "data", null: false
|
||||
t.integer "schema_version", null: false
|
||||
t.datetime "viewed_at"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.index ["account_id", "year"], name: "index_generated_annual_reports_on_account_id_and_year", unique: true
|
||||
end
|
||||
|
||||
create_table "identities", force: :cascade do |t|
|
||||
t.string "provider", default: "", null: false
|
||||
t.string "uid", default: "", null: false
|
||||
|
@ -1226,6 +1237,7 @@ ActiveRecord::Schema[7.1].define(version: 2024_01_09_103012) do
|
|||
add_foreign_key "follow_requests", "accounts", name: "fk_76d644b0e7", on_delete: :cascade
|
||||
add_foreign_key "follows", "accounts", column: "target_account_id", name: "fk_745ca29eac", on_delete: :cascade
|
||||
add_foreign_key "follows", "accounts", name: "fk_32ed1b5560", on_delete: :cascade
|
||||
add_foreign_key "generated_annual_reports", "accounts"
|
||||
add_foreign_key "identities", "users", name: "fk_bea040f377", on_delete: :cascade
|
||||
add_foreign_key "imports", "accounts", name: "fk_6db1b6e408", on_delete: :cascade
|
||||
add_foreign_key "invites", "users", on_delete: :cascade
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue