Files
windmill/backend/migrations/20260408151657_ws_specific_table.up.sql
Diego Imbert d2992af8be refactor: move ws_specific from resource column to separate table (#8766)
* Move ws_specific to separate table

* on delete cascade

* feat: handle ws_specific on resource rename and delete

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* is_false never used

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-04-08 16:10:41 +00:00

18 lines
591 B
SQL

-- Create the ws_specific table
CREATE TABLE IF NOT EXISTS ws_specific (
workspace_id VARCHAR(50) NOT NULL REFERENCES workspace(id) ON DELETE CASCADE ON UPDATE CASCADE,
item_kind VARCHAR(50) NOT NULL,
path VARCHAR(255) NOT NULL,
PRIMARY KEY (workspace_id, item_kind, path)
);
-- Migrate existing data from resource.ws_specific
INSERT INTO ws_specific (workspace_id, item_kind, path)
SELECT workspace_id, 'resource', path
FROM resource
WHERE ws_specific = true
ON CONFLICT DO NOTHING;
-- Drop the column from resource
ALTER TABLE resource DROP COLUMN IF EXISTS ws_specific;