-
Notifications
You must be signed in to change notification settings - Fork 263
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add name_hash as nullable #9091
Conversation
Otherwise the migration on pgsql don't work. Signed-off-by: Daniel Kesselberg <[email protected]>
@@ -56,6 +56,11 @@ public function changeSchema(IOutput $output, Closure $schemaClosure, array $opt | |||
$mailboxesTable->addUniqueIndex(['account_id', 'name_hash'], $indexNew); | |||
} | |||
|
|||
$nameHashColumn = $mailboxesTable->getColumn('name_hash'); | |||
if (!$nameHashColumn->getNotnull()) { | |||
$nameHashColumn->setNotnull(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure about this one.
The default is still NULL and the value is omitted on insert a not null violation is thrown.
Do we need a new default as well?
-- auto-generated definition
create table oc_mail_mailboxes
(
id serial
primary key,
name varchar(255) not null,
account_id integer not null,
attributes varchar(255) default '[]'::character varying not null,
delimiter varchar(1) default NULL::character varying,
messages integer not null,
unseen integer not null,
selectable boolean default false,
special_use varchar(255) default '[]'::character varying not null,
sync_new_lock integer,
sync_changed_lock integer,
sync_vanished_lock integer,
sync_new_token varchar(255) default NULL::character varying,
sync_changed_token varchar(255) default NULL::character varying,
sync_vanished_token varchar(255) default NULL::character varying,
sync_in_background boolean default false,
my_acls varchar(32) default NULL::character varying,
shared boolean default false,
name_hash varchar(255) default NULL::character varying not null
);
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When we change not from not null to null here, all rows should have their name_hash filled. And for inserts we have to make sure to always write with the hash. If we insert without, there will be an error. I think that is fine and nothing we can improve.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with a pg setup. Could trigger the bug with an existing account before going to the original migration. The migration passes with the changes of this PR.
Thank you 🙏
/backport to stable3.5 |
Fix #9089
Otherwise the migration on pgsql don't work.