WIP: Include pghero in the local environment #219

Draft
bustikiller wants to merge 5 commits from pghero-docker into main
2 changed files with 33 additions and 1 deletions
Showing only changes of commit 356e799c68 - Show all commits

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