Skip to content

Commit bcc37d3

Browse files
multi: rename sql kvstores session_id to group_id
Rename the session_id to group_id in kvstores table in the SQL store, to better represent how the field is actually used. Note that this is a breaking change, and would normally require a new migration. But as the SQL store is not used in production, and only enabled under the dev build flag, we can rename it without a new migration, as there's no users of the SQL store in production.
1 parent c7e9d58 commit bcc37d3

File tree

6 files changed

+116
-116
lines changed

6 files changed

+116
-116
lines changed

db/sqlc/kvstores.sql.go

Lines changed: 48 additions & 48 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

db/sqlc/migrations/000003_kvstores.up.sql

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ CREATE TABLE IF NOT EXISTS features (
2121
CREATE UNIQUE INDEX IF NOT EXISTS features_name_idx ON features (name);
2222

2323
-- kvstores houses key-value pairs under various namespaces determined
24-
-- by the rule name, session ID, and feature name.
24+
-- by the rule name, group ID, and feature name.
2525
CREATE TABLE IF NOT EXISTS kvstores (
2626
-- The auto incrementing primary key.
2727
id INTEGER PRIMARY KEY,
@@ -35,15 +35,15 @@ CREATE TABLE IF NOT EXISTS kvstores (
3535
-- kv_store.
3636
rule_id BIGINT REFERENCES rules(id) NOT NULL,
3737

38-
-- The session ID that this kv_store belongs to.
39-
-- If this is set, then this kv_store is a session-specific
38+
-- The group ID that this kv_store belongs to.
39+
-- If this is set, then this kv_store is a session-group specific
4040
-- kv_store for the given rule.
41-
session_id BIGINT REFERENCES sessions(id) ON DELETE CASCADE,
41+
group_id BIGINT REFERENCES sessions(id) ON DELETE CASCADE,
4242

4343
-- The feature name that this kv_store belongs to.
4444
-- If this is set, then this kv_store is a feature-specific
45-
-- kvstore under the given session ID and rule name.
46-
-- If this is set, then session_id must also be set.
45+
-- kvstore under the given group ID and rule name.
46+
-- If this is set, then group_id must also be set.
4747
feature_id BIGINT REFERENCES features(id),
4848

4949
-- The key of the entry.
@@ -54,4 +54,4 @@ CREATE TABLE IF NOT EXISTS kvstores (
5454
);
5555

5656
CREATE UNIQUE INDEX IF NOT EXISTS kvstores_lookup_idx
57-
ON kvstores (entry_key, rule_id, perm, session_id, feature_id);
57+
ON kvstores (entry_key, rule_id, perm, group_id, feature_id);

db/sqlc/models.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

db/sqlc/querier.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)