中性化运行上下文字段
This commit is contained in:
@@ -209,7 +209,7 @@ CREATE INDEX IF NOT EXISTS idx_task_events_task_created_at ON task_events(task_i
|
||||
CREATE TABLE IF NOT EXISTS task_runtime_contexts (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
task_id BIGINT NOT NULL UNIQUE REFERENCES fulfillment_tasks(id) ON DELETE CASCADE,
|
||||
browser_session_id TEXT NOT NULL DEFAULT '',
|
||||
runtime_session_id TEXT NOT NULL DEFAULT '',
|
||||
login_type TEXT NOT NULL DEFAULT '',
|
||||
nickname TEXT NOT NULL DEFAULT '',
|
||||
role_id TEXT NOT NULL DEFAULT '',
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
DO $$
|
||||
BEGIN
|
||||
IF to_regclass('public.task_runtime_contexts') IS NOT NULL
|
||||
AND EXISTS (
|
||||
SELECT 1
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema = 'public'
|
||||
AND table_name = 'task_runtime_contexts'
|
||||
AND column_name = 'browser_session_id'
|
||||
)
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM information_schema.columns
|
||||
WHERE table_schema = 'public'
|
||||
AND table_name = 'task_runtime_contexts'
|
||||
AND column_name = 'runtime_session_id'
|
||||
) THEN
|
||||
ALTER TABLE task_runtime_contexts RENAME COLUMN browser_session_id TO runtime_session_id;
|
||||
END IF;
|
||||
END $$;
|
||||
Reference in New Issue
Block a user