Skip to content

Instantly share code, notes, and snippets.

@bmvakili
Created January 18, 2014 00:06
Show Gist options
  • Save bmvakili/8484057 to your computer and use it in GitHub Desktop.
Save bmvakili/8484057 to your computer and use it in GitHub Desktop.
update iff tables already created with service builder, update id_ to id
SET FOREIGN_KEY_CHECKS = 0;
SET GROUP_CONCAT_MAX_LEN=32768;
SET @tables = NULL;
SELECT GROUP_CONCAT(table_name) INTO @tables
FROM information_schema.columns
WHERE table_schema = (SELECT DATABASE()) AND (LOWER(table_name) like 'x%' OR LOWER(table_name) like 'sm%' OR LOWER(table_name) like 'invites%' OR LOWER(table_name) like 'blockvendor%' ) AND column_name = 'id_';
select REPLACE(@tables, ',', ' change id_ id int(11) ; alter table ') into @tables;
select CONCAT('alter table ', @tables) into @tables;
select CONCAT(@tables, ' change id_ id int(11) ;') into @tables;
select @tables;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment