22 lines
534 B
Ruby
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
|