wedding-planner/db/migrate/20250122204932_create_pghero_stats_tables.rb

24 lines
572 B
Ruby
Raw Normal View History

2025-01-23 20:59:31 +00:00
# Copyright (C) 2024 Manuel Bustillo
2025-01-23 21:57:18 +01:00
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