change StreamID type from int to string

This commit is contained in:
jojo aquino 2025-04-26 09:28:23 +01:00
parent 189035fa63
commit 8a90a6b170

View File

@ -0,0 +1,19 @@
BEGIN TRANSACTION;
-- Create a new column with the desired data type
ALTER TABLE "EventLogs"
ADD COLUMN IF NOT EXISTS "NewStreamID" VARCHAR(255) NOT NULL;
-- Update values in the new column (cast the original int8 to varchar)
UPDATE "EventLogs"
SET "NewStreamID" = CAST("StreamID" AS VARCHAR);
-- Drop the original column (keeping only valid data)
ALTER TABLE "EventLogs"
DROP COLUMN "StreamID";
-- Rename the new column to the original name
ALTER TABLE "EventLogs"
RENAME COLUMN "NewStreamID" TO "StreamID";
COMMIT TRANSACTION;