wedding-planner/db/migrate/20250122204932_create_pghero_stats_tables.rb
Manuel Bustillo 356e799c68
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
WIP store stats history
2025-01-23 21:57:18 +01:00

22 lines
534 B
Ruby

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