change StreamID type from int to string
This commit is contained in:
		
							parent
							
								
									189035fa63
								
							
						
					
					
						commit
						8a90a6b170
					
				| @ -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; | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user