Merged
Conversation
…ntby Part of multi-user RLS architecture (PR1 of 7). Changes to init.sql (fresh deployments): - cml_data: add user_id TEXT NOT NULL DEFAULT 'user1' - cml_metadata: add user_id, PRIMARY KEY (cml_id, sublink_id, user_id), keep UNIQUE (cml_id, sublink_id) for backward compat until PR3 - cml_stats: add user_id, PRIMARY KEY (cml_id, user_id) - update_cml_stats: add optional target_user_id param (DEFAULT 'user1') so existing single-arg call sites keep working - cml_data_1h: add user_id to SELECT and GROUP BY - compress_segmentby: add user_id as leading key - Add idx_cml_data_user_id and idx_cml_metadata_user_id indexes Migration files for existing deployments: - database/migrations/001_add_user_id.sql - database/migrations/002_update_compression_segmentby.sql - database/migrations/003_update_aggregate_user_id.sql Backward compatible: DEFAULT 'user1' + retained UNIQUE constraint mean the unmodified parser continues to work without any code changes.
_timescaledb_internal.is_compressed_chunk() does not exist in all TimescaleDB versions. Use the stable public view instead.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #32 +/- ##
=======================================
Coverage 73.18% 73.18%
=======================================
Files 22 22
Lines 1965 1965
=======================================
Hits 1438 1438
Misses 527 527
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #31.
Adds
user_idto all three tables, updates thecml_data_1hcontinuous aggregate and compressionsegmentby, and provides migration files for existing deployments.Files changed
database/init.sql—user_idcolumn + updated PKs + indexes +update_cml_stats()signature +cml_data_1hGROUP BY + compression segmentbydatabase/migrations/001_add_user_id.sqldatabase/migrations/002_update_compression_segmentby.sqldatabase/migrations/003_update_aggregate_user_id.sqldatabase/MIGRATION.md— apply instructions for existing deploymentsBackward compatible —
DEFAULT 'user1'on all columns; parser and webserver need no changes.Migration was applied and verified on a live database. Next: #31 PR 2 (
feat/db-roles-rls).