Skip to content

Instantly share code, notes, and snippets.

@cjsewell
Created November 18, 2015 01:15
Show Gist options
  • Save cjsewell/319491b2976c5ad27103 to your computer and use it in GitHub Desktop.
Save cjsewell/319491b2976c5ad27103 to your computer and use it in GitHub Desktop.
Replace locales of dataobjects in Silverstripe. Handy if you want to duplicate a site in a new language, but want to keep the old content as a starting point
// Returns list of tables which has a Locale column
SELECT DISTINCT TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME IN ('Locale')
AND TABLE_SCHEMA='SS_mydatabase';
// Replace the locale en_NZ with en_US
UPDATE `ATableFromAbove` set `Locale` = "en_US" WHERE `Locale` = "en_NZ";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment