Skip to content

Commit

Permalink
Updated dbupdate scripts so they will no longer fail when there are m…
Browse files Browse the repository at this point in the history
…ultiple users with the same e-mail (ezsystems#1445)
  • Loading branch information
mateuszbieniek authored and andrerom committed Nov 1, 2019
1 parent 3db617d commit 2d60365
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion update/database/mysql/5.0/dbupdate-4.7.0-to-5.0.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ UPDATE ezcobj_state_group_language SET real_language_id = language_id & ~1;
ALTER TABLE ezgeneral_digest_user_settings ADD COLUMN user_id int(11) NOT NULL default '0';
DELETE FROM ezgeneral_digest_user_settings WHERE address NOT IN (SELECT email FROM ezuser);
UPDATE ezgeneral_digest_user_settings SET user_id = (SELECT ezuser.contentobject_id
FROM ezuser WHERE ezuser.email = ezgeneral_digest_user_settings.address);
FROM ezuser WHERE ezuser.email = ezgeneral_digest_user_settings.address LIMIT 1);
ALTER TABLE ezgeneral_digest_user_settings ADD UNIQUE INDEX ezgeneral_digest_user_id (user_id);
ALTER TABLE ezgeneral_digest_user_settings DROP COLUMN address;
ALTER TABLE ezuser ADD INDEX ezuser_login (login);
2 changes: 1 addition & 1 deletion update/database/postgresql/5.0/dbupdate-4.7.0-to-5.0.0.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ UPDATE ezcobj_state_group_language SET real_language_id = language_id & ~1;
ALTER TABLE ezgeneral_digest_user_settings ADD user_id integer DEFAULT 0 NOT NULL;
DELETE FROM ezgeneral_digest_user_settings WHERE address NOT IN (SELECT email FROM ezuser);
UPDATE ezgeneral_digest_user_settings SET user_id = (SELECT ezuser.contentobject_id
FROM ezuser WHERE ezuser.email = ezgeneral_digest_user_settings.address);
FROM ezuser WHERE ezuser.email = ezgeneral_digest_user_settings.address LIMIT 1);
CREATE INDEX ezgeneral_digest_user_id ON ezgeneral_digest_user_settings USING btree (user_id);
ALTER TABLE ezgeneral_digest_user_settings DROP COLUMN address;
CREATE INDEX ezuser_login ON ezuser USING btree (login);

0 comments on commit 2d60365

Please sign in to comment.