Skip to content

Instantly share code, notes, and snippets.

@fakechris
Created June 3, 2013 05:57
Show Gist options
  • Save fakechris/5696321 to your computer and use it in GitHub Desktop.
Save fakechris/5696321 to your computer and use it in GitHub Desktop.
delimiter #
create trigger fix_dot_account_external_ids after insert on account_external_ids
for each row
begin
SET @external_id = NEW.external_id;
if @external_id like 'gerrit:*' then
SET @new_external_id = REPLACE(@external_id, 'gerrit:', 'username:');
insert into account_external_ids (account_id, email_address, password, external_id) values (new.account_id, new.email_address, new.password, @new_external_id);
end if;
end#
delimiter ;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment