From 07c147b369ba456774b7619893e8dec2f4b3e737 Mon Sep 17 00:00:00 2001 From: Torben Sorensen Date: Wed, 3 Dec 2025 22:51:05 -0800 Subject: [PATCH] minor db index work --- README.md | 68 +++++++++++++++++++++++++++++++++++- sql/initial_schema.sql | 1 + sql/master_schema_rollup.sql | 3 +- 3 files changed, 70 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2867e98a..e726bf01 100644 --- a/README.md +++ b/README.md @@ -290,4 +290,70 @@ Schema Application: It then immediately executes sql/master_schema_rollup.sql to Test Execution: Your tests run against this clean, isolated schema. -This approach is faster, more reliable, and removes the need for sudo access within the CI pipeline. \ No newline at end of file +This approach is faster, more reliable, and removes the need for sudo access within the CI pipeline. + + + +gitea-runner@projectium:~$ pm2 install pm2-logrotate +[PM2][Module] Installing NPM pm2-logrotate module +[PM2][Module] Calling [NPM] to install pm2-logrotate ... + +added 161 packages in 5s + +21 packages are looking for funding + run `npm fund` for details +npm notice +npm notice New patch version of npm available! 11.6.3 -> 11.6.4 +npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.6.4 +npm notice To update run: npm install -g npm@11.6.4 +npm notice +[PM2][Module] Module downloaded +[PM2][WARN] Applications pm2-logrotate not running, starting... +[PM2] App [pm2-logrotate] launched (1 instances) +Module: pm2-logrotate +$ pm2 set pm2-logrotate:max_size 10M +$ pm2 set pm2-logrotate:retain 30 +$ pm2 set pm2-logrotate:compress false +$ pm2 set pm2-logrotate:dateFormat YYYY-MM-DD_HH-mm-ss +$ pm2 set pm2-logrotate:workerInterval 30 +$ pm2 set pm2-logrotate:rotateInterval 0 0 * * * +$ pm2 set pm2-logrotate:rotateModule true +Modules configuration. Copy/Paste line to edit values. +[PM2][Module] Module successfully installed and launched +[PM2][Module] Checkout module options: `$ pm2 conf` +┌────┬───────────────────────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐ +│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │ +├────┼───────────────────────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤ +│ 2 │ flyer-crawler-analytics-worker │ default │ 0.0.0 │ fork │ 3846981 │ 7m │ 5 │ online │ 0% │ 55.8mb │ git… │ disabled │ +│ 11 │ flyer-crawler-api │ default │ 0.0.0 │ fork │ 3846987 │ 7m │ 0 │ online │ 0% │ 59.0mb │ git… │ disabled │ +│ 12 │ flyer-crawler-worker │ default │ 0.0.0 │ fork │ 3846988 │ 7m │ 0 │ online │ 0% │ 54.2mb │ git… │ disabled │ +└────┴───────────────────────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘ +Module +┌────┬──────────────────────────────┬───────────────┬──────────┬──────────┬──────┬──────────┬──────────┬──────────┐ +│ id │ module │ version │ pid │ status │ ↺ │ cpu │ mem │ user │ +├────┼──────────────────────────────┼───────────────┼──────────┼──────────┼──────┼──────────┼──────────┼──────────┤ +│ 13 │ pm2-logrotate │ 3.0.0 │ 3848878 │ online │ 0 │ 0% │ 20.1mb │ git… │ +└────┴──────────────────────────────┴───────────────┴──────────┴──────────┴──────┴──────────┴──────────┴──────────┘ +gitea-runner@projectium:~$ pm2 set pm2-logrotate:max_size 10M +[PM2] Module pm2-logrotate restarted +[PM2] Setting changed +Module: pm2-logrotate +$ pm2 set pm2-logrotate:max_size 10M +$ pm2 set pm2-logrotate:retain 30 +$ pm2 set pm2-logrotate:compress false +$ pm2 set pm2-logrotate:dateFormat YYYY-MM-DD_HH-mm-ss +$ pm2 set pm2-logrotate:workerInterval 30 +$ pm2 set pm2-logrotate:rotateInterval 0 0 * * * +$ pm2 set pm2-logrotate:rotateModule true +gitea-runner@projectium:~$ pm2 set pm2-logrotate:retain 14 +[PM2] Module pm2-logrotate restarted +[PM2] Setting changed +Module: pm2-logrotate +$ pm2 set pm2-logrotate:max_size 10M +$ pm2 set pm2-logrotate:retain 14 +$ pm2 set pm2-logrotate:compress false +$ pm2 set pm2-logrotate:dateFormat YYYY-MM-DD_HH-mm-ss +$ pm2 set pm2-logrotate:workerInterval 30 +$ pm2 set pm2-logrotate:rotateInterval 0 0 * * * +$ pm2 set pm2-logrotate:rotateModule true +gitea-runner@projectium:~$ diff --git a/sql/initial_schema.sql b/sql/initial_schema.sql index 9d7cf9df..07a84f1a 100644 --- a/sql/initial_schema.sql +++ b/sql/initial_schema.sql @@ -235,6 +235,7 @@ CREATE TABLE IF NOT EXISTS public.store_locations ( store_id BIGINT REFERENCES public.stores(store_id) ON DELETE CASCADE, address_id BIGINT NOT NULL REFERENCES public.addresses(address_id) ON DELETE CASCADE, created_at TIMESTAMPTZ DEFAULT now() NOT NULL, + UNIQUE(store_id, address_id), updated_at TIMESTAMPTZ DEFAULT now() NOT NULL ); COMMENT ON TABLE public.store_locations IS 'Stores physical locations of stores with geographic data for proximity searches.'; diff --git a/sql/master_schema_rollup.sql b/sql/master_schema_rollup.sql index d4d1d52f..108e9b06 100644 --- a/sql/master_schema_rollup.sql +++ b/sql/master_schema_rollup.sql @@ -250,7 +250,8 @@ CREATE INDEX IF NOT EXISTS idx_notifications_user_id_created_at ON public.notifi CREATE TABLE IF NOT EXISTS public.store_locations ( store_location_id BIGINT PRIMARY KEY GENERATED ALWAYS AS IDENTITY, store_id BIGINT REFERENCES public.stores(store_id) ON DELETE CASCADE, - address_id BIGINT NOT NULL REFERENCES public.addresses(address_id) ON DELETE CASCADE, + address_id BIGINT NOT NULL REFERENCES public.addresses(address_id) ON DELETE CASCADE, + UNIQUE(store_id, address_id), created_at TIMESTAMPTZ DEFAULT now() NOT NULL, updated_at TIMESTAMPTZ DEFAULT now() NOT NULL );