mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-31 06:23:08 +02:00
Request body is now an object
This commit is contained in:
16
src-tauri/migrations/20231112180500_body_object.sql
Normal file
16
src-tauri/migrations/20231112180500_body_object.sql
Normal file
@@ -0,0 +1,16 @@
|
||||
-- Rename old column to backup name
|
||||
ALTER TABLE http_requests
|
||||
RENAME COLUMN body TO body_old;
|
||||
|
||||
-- Create desired new body column
|
||||
ALTER TABLE http_requests
|
||||
ADD COLUMN body TEXT NOT NULL DEFAULT '{}';
|
||||
|
||||
-- Copy data from old to new body, in new JSON format
|
||||
UPDATE http_requests
|
||||
SET body = CASE WHEN body_old IS NULL THEN '{}' ELSE JSON_OBJECT('text', body_old) END
|
||||
WHERE TRUE;
|
||||
|
||||
-- Drop old column
|
||||
ALTER TABLE http_requests
|
||||
DROP COLUMN body_old;
|
||||
Reference in New Issue
Block a user