From 0e1f670027d949b6c541bc330e79bce4d5fcb333 Mon Sep 17 00:00:00 2001 From: Nir Ben-Rei Date: Wed, 1 Jun 2022 14:12:42 +0300 Subject: [PATCH] Add index to operations table (#768) * add index for operations_resource_type_resource_id_index on operations table --- storage/postgres/constant.go | 2 +- ...1100000_operations_resource_type_resource_id_index.down.sql | 1 + ...601100000_operations_resource_type_resource_id_index.up.sql | 3 +++ 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 storage/postgres/migrations/20220601100000_operations_resource_type_resource_id_index.down.sql create mode 100644 storage/postgres/migrations/20220601100000_operations_resource_type_resource_id_index.up.sql diff --git a/storage/postgres/constant.go b/storage/postgres/constant.go index d8c979a15..2772d5c49 100644 --- a/storage/postgres/constant.go +++ b/storage/postgres/constant.go @@ -2,4 +2,4 @@ package postgres // todo: get automatically from folder // change this line with the latest version of the migrations: -const latestMigrationVersion = "20211125100000" +const latestMigrationVersion = "20220601100000" diff --git a/storage/postgres/migrations/20220601100000_operations_resource_type_resource_id_index.down.sql b/storage/postgres/migrations/20220601100000_operations_resource_type_resource_id_index.down.sql new file mode 100644 index 000000000..7e9484ddf --- /dev/null +++ b/storage/postgres/migrations/20220601100000_operations_resource_type_resource_id_index.down.sql @@ -0,0 +1 @@ +DROP INDEX IF EXISTS operations_resource_type_resource_id_index; \ No newline at end of file diff --git a/storage/postgres/migrations/20220601100000_operations_resource_type_resource_id_index.up.sql b/storage/postgres/migrations/20220601100000_operations_resource_type_resource_id_index.up.sql new file mode 100644 index 000000000..d82680f37 --- /dev/null +++ b/storage/postgres/migrations/20220601100000_operations_resource_type_resource_id_index.up.sql @@ -0,0 +1,3 @@ +CREATE INDEX IF NOT EXISTS operations_resource_type_resource_id_index + on operations (resource_type, resource_id); +