wedding-planner/db/migrate/20250122204932_create_pghero_stats_tables.rb
Manuel Bustillo 7aaa671bbf
Some checks failed
Add copyright notice / copyright_notice (pull_request) Failing after 48s
Check usage of free licenses / check-licenses (pull_request) Failing after 46s
Build Nginx-based docker image / build-static-assets (pull_request) Failing after 48s
Run unit tests / unit_tests (pull_request) Successful in 4m9s
Add copyright notice
2025-01-23 20:59:31 +00:00

24 lines
572 B
Ruby

# Copyright (C) 2024 Manuel Bustillo
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