WIP store stats history
Some checks failed
Add copyright notice / copyright_notice (pull_request) Successful in 1m57s
Check usage of free licenses / check-licenses (pull_request) Successful in 3m50s
Run unit tests / unit_tests (pull_request) Successful in 4m33s
Build Nginx-based docker image / build-static-assets (pull_request) Has been cancelled

This commit is contained in:
Manuel Bustillo 2025-01-23 21:57:18 +01:00
parent 259d559b71
commit 356e799c68
2 changed files with 33 additions and 1 deletions

View File

@ -0,0 +1,21 @@
class CreatePgheroStatsTables < ActiveRecord::Migration[8.0]
def up
execute <<~SQL
CREATE TABLE "pghero_query_stats" (
"id" bigserial primary key,
"database" text,
"user" text,
"query" text,
"query_hash" bigint,
"total_time" float,
"calls" bigint,
"captured_at" timestamp
);
CREATE INDEX ON "pghero_query_stats" ("database", "captured_at");
SQL
end
def down
drop_table :pghero_query_stats, if_exists: true, force: :cascade
end
end

13
db/schema.rb generated
View File

@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2025_01_22_202836) do
ActiveRecord::Schema[8.0].define(version: 2025_01_22_204932) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_catalog.plpgsql"
enable_extension "pg_stat_statements"
@ -68,6 +68,17 @@ ActiveRecord::Schema[8.0].define(version: 2025_01_22_202836) do
t.index ["wedding_id"], name: "index_guests_on_wedding_id"
end
create_table "pghero_query_stats", force: :cascade do |t|
t.text "database"
t.text "user"
t.text "query"
t.bigint "query_hash"
t.float "total_time"
t.bigint "calls"
t.datetime "captured_at", precision: nil
t.index ["database", "captured_at"], name: "pghero_query_stats_database_captured_at_idx"
end
create_table "seats", id: :uuid, default: -> { "gen_random_uuid()" }, force: :cascade do |t|
t.uuid "guest_id", null: false
t.uuid "tables_arrangement_id", null: false