From 00ecc6a936366b259ed2911393dde856defc0cd8 Mon Sep 17 00:00:00 2001 From: Cameron Reeves Date: Thu, 6 Aug 2026 03:10:59 +1000 Subject: [PATCH] feat: remove Elasticsearch drop task and constants (PPT-2644) Search moves to PostgreSQL full-text search; there are no ES indices to drop. `drop` now only drops the PostgreSQL DB. NOTE: ship in the same platform release as the PlaceOS/local change that removes the hard-reset drop:elastic invocation. Co-Authored-By: Claude Fable 5 --- README.md | 8 ++------ src/constants.cr | 3 --- src/sam.cr | 11 ++--------- src/tasks/database.cr | 10 ---------- 4 files changed, 4 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index cff5525..90cb662 100644 --- a/README.md +++ b/README.md @@ -240,12 +240,8 @@ By default, the backup will take place at midnight every day. * `az_container`: Defaults to `AZURE_STORAGE_CONTAINER`, required. * `az_blob_object`: Object to restore DB from. Defaults to `AZURE_STORAGE_BLOB_OBJECT`, required. -- `drop`: Drops Elasticsearch and PostgreSQL DB - * Runs `drop:elastic` and `drop:db` via environmental configuration - -- `drop:elastic`: Deletes all elastic indices tables - * `host`: Defaults to `ES_HOST` || `"localhost"` - * `port`: Defaults to `ES_PORT` || `9200` +- `drop`: Drops the PostgreSQL DB + * Runs `drop:db` via environmental configuration - `drop:db`: Drops all PostgreSQL DB tables * `db`: Defaults `PG_DB` || `"postgres"` diff --git a/src/constants.cr b/src/constants.cr index f935c4e..43afa36 100644 --- a/src/constants.cr +++ b/src/constants.cr @@ -47,9 +47,6 @@ module PlaceOS # Resource configurations - ES_HOST = ENV["ES_HOST"]? || "localhost" - ES_PORT = ENV["ES_PORT"]?.try &.to_i || 9200 - PG_DB = ENV["PG_DB"]? || "postgres" PG_HOST = ENV["PG_HOST"]? || "localhost" PG_PORT = ENV["PG_PORT"]?.try &.to_i || 5432 diff --git a/src/sam.cr b/src/sam.cr index bce644a..250055e 100644 --- a/src/sam.cr +++ b/src/sam.cr @@ -215,18 +215,11 @@ namespace "migrate" do end end -desc "Drops Elasticsearch and PostgreSQL DB" -task "drop", %w[drop:db drop:elastic] do +desc "Drops the PostgreSQL DB" +task "drop", %w[drop:db] do end namespace "drop" do - desc "Deletes all elastic indices tables" - task "elastic" do |_, args| - host = (args["host"]? || PlaceOS::ES_HOST).to_s - port = (args["port"]? || PlaceOS::ES_PORT).to_i - PlaceOS::Tasks.drop_elastic_indices(host, port) - end - desc "Drops all PostgreSQL DB tables" task "db" do |_, args| arguments = { diff --git a/src/tasks/database.cr b/src/tasks/database.cr index 1bebc3e..d96fb71 100644 --- a/src/tasks/database.cr +++ b/src/tasks/database.cr @@ -126,16 +126,6 @@ module PlaceOS::Tasks::Database PgORM::Database.exec_sql(sql) end - def drop_elastic_indices(elastic_host : String, elastic_port : Int32) - uri = URI.new( - host: elastic_host, - port: elastic_port, - path: "/_all", - scheme: "http" - ) - HTTP::Client.delete(uri) - end - def migrate_rethink_to_pg( path : String, pg_host : String,