Last active
May 4, 2022 17:13
-
-
Save mitchtabian/62464966b74d83c569075099aef6348e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Suppose I have the following table: */ | |
CREATE TABLE {table} ( | |
{id} STRING PRIMARY KEY, | |
{name} STRING NOT NULL COLLATE LOCALIZED, | |
{data} BLOB | |
) | |
/* | |
* Where {data} is is large object such as: | |
* class Data( | |
* val name: String, // <-- Same as {name} field in table | |
* // ... Whole bunch of other stuff | |
* ) | |
*/ | |
/* | |
* I want to: | |
* 1. Change STRING to TEXT type for {table}.{name} column | |
* 2. Populate updated {table}.{name} column with information from {table}.{data.name} | |
*/ | |
/* What would the ALTER TABLE statement look like? Mostly unsure of how to select fields from a BLOB. I got this far: */ | |
ALTER TABLE {table} DROP COLUMN {name}; | |
ALTER TABLE {table} ADD COLUMN {name} TEXT NOT NULL COLLATE LOCALIZED; | |
UPDATE {table} SET {name} = ??? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment