You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BEGIN; --start a transaction; this ensures that your changes won't be written until you COMMIT
.schema --this will show you your current schema
PRAGMA writable_schema=1; --this enables you to edit the schemaSELECT*FROM sqlite_master; --show the raw data SQLite saves related to your schemaUPDATE sqlite_master SET sql=replace(sql, 'county', 'county_id') WHERE name='people'; --simple string replace
.schema --verify CREATE TABLE is correctUPDATE sqlite_master SET sql='CREATE INDEX people_county_id_index on people(county_id)'WHERE name='people_county_index'; --update index SQLUPDATE sqlite_master SET name='people_county_id_index'WHERE name='people_county_index'; --update index name
.schema --verify index is correctSELECT*FROM sqlite_master; --double-check all raw data once more
PRAGMA writable_schema=0; --disable editing the schemaCOMMIT; --save the changes to the database
.exit
The important thing to note here is what's on line 5:
UPDATE sqlite_master SET sql=replace(sql, 'county', 'county_id') WHERE name='people'; --simple string replace
Here's the output WP-Syntax creates:
BEGIN; --start a transaction; this ensures that your changes won't be written until you COMMIT
.schema --this will show you your current schema
PRAGMA writable_schema=1; --this enables you to edit the schemaSELECT*FROM sqlite_master; --show the raw data SQLite saves related to your schemaUPDATE sqlite_master SET SQL=REPLACE(SQL, 'county', 'county_id') WHERE name='people'; --simple string replace
.schema --verify CREATE TABLE is correctUPDATE sqlite_master SET SQL='CREATE INDEX people_county_id_index on people(county_id)'WHERE name='people_county_index'; --update index SQLUPDATE sqlite_master SET name='people_county_id_index'WHERE name='people_county_index'; --update index name
.schema --verify index is correctSELECT*FROM sqlite_master; --double-check all raw data once more
PRAGMA writable_schema=0; --disable editing the schemaCOMMIT; --save the changes to the database
.exit
Notice how in line 5, all instances of sql are now capitalized. Here, sql is a lowercase column name and should remain lowercase when WP-Syntax renders it.
The text was updated successfully, but these errors were encountered:
http://www.gfairchild.com/2012/08/03/how-to-rename-columns-in-an-sqlite-database/ shows the example in practice. Here's the chunk of code to be highlighted:
The important thing to note here is what's on line 5:
Here's the output WP-Syntax creates:
Notice how in line 5, all instances of
sql
are now capitalized. Here,sql
is a lowercase column name and should remain lowercase when WP-Syntax renders it.The text was updated successfully, but these errors were encountered: