-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow variable creation with different target environments #6168
Conversation
52a3dc4
to
00ff55a
Compare
This already is not possible at the DB level, so you may have a UI state issue if that seems to be the case. If you see this, can you try refreshing the page? Also note that the It sounds like it may be helpful with some context about how variables are stored in the database. This is the schema: CREATE TABLE project_variables (
id UUID NOT NULL DEFAULT uuid_generate_v4() PRIMARY KEY,
project_id UUID NOT NULL REFERENCES projects(id) ON DELETE CASCADE,
name TEXT NOT NULL,
value TEXT NOT NULL,
-- Encryption key ID if the value is encrypted
value_encryption_key_id TEXT NOT NULL DEFAULT '',
-- Environment it belongs to ("prod" or "dev").
-- If empty, then the value is used as the fallback for all environments.
environment TEXT NOT NULL DEFAULT '',
-- The user who most recently edited the variable
updated_by_user_id UUID REFERENCES users(id) ON DELETE SET NULL,
created_on TIMESTAMPTZ DEFAULT now() NOT NULL,
updated_on TIMESTAMPTZ DEFAULT now() NOT NULL
);
CREATE UNIQUE INDEX project_variables_project_id_environment_name_idx ON project_variables (project_id, environment, lower(name)); Note that there's a unique index on INSERT INTO project_variables (project_id, environment, name, value, value_encryption_key_id, updated_by_user_id, updated_on)
VALUES ...
ON CONFLICT (project_id, environment, lower(name)) DO UPDATE SET
value = EXCLUDED.value,
value_encryption_key_id = EXCLUDED.value_encryption_key_id,
updated_by_user_id = EXCLUDED.updated_by_user_id,
updated_on = now()
RETURNING * When resolving variables for the runtime, it first builds a list of all variables with |
93a2e52
to
642a68d
Compare
Latest demo: CleanShot.2024-12-03.at.13.38.49.mp4 |
Added more checks on the client side to check for duplicates before hitting the actual Update API operation call. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
closes #6150
https://www.notion.so/rilldata/Environment-Variables-management-UI-42304f145b07410d86c2a523496aa6bc
test
already exists for the target developmentCleanShot.2024-11-26.at.11.28.13.mp4