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
Accesstoken generation fails, user_agent field has no default #136
Comments
Thanks for the report, @mrvdb. I think this would be a good opportunity to start using that column for what it's originally there for -- storing the |
Agreed. The proposed change of the column definition should still be part of that resolution as well I think. |
I can't reproduce this. Is this a user who has never logged in without sending the user agent? |
The error will only manifest on newer versions of MySQL, I believe. |
oh ok, so not with sqlite3? |
Also the schema appears to be setting Still learning some SQL things so maybe I'm misinterpreting? |
That's odd, the schema our mysql/mariadb was using did definitely not have the I see there is a byte representation of the schema in |
It seems to be a migration issue, see a3e287a Our db was created before that revision and migration never picked up that change. Not sure how to get to T529 which is referred to in that revision. |
That would be over on phabricator, https://phabricator.write.as/T529 |
Thanks, so local fixing resolves this particular issue. That it slipped by migration is another issue ;-) I sort of assumed the migration would be based on some hash-function over the schema.sql input (per db presumably), thus guaranteeing to at least syntactically catching all changes to the schema. |
Awesome, glad we got you sorted. I'm not sure how we're doing it now, but something like that would be ideal. Guaranteed migrations or explicit failures. |
The field
accesstokens.user_agent
is set tonot null
but has no default and the code does not explicitly set it on inserting an accesstoken. When trying to generate an accesstoken through the API, it fails because of this.Reproduce:
This will generate an error for the user. Writefreely log shows:
Workaround:
alter table accesstokens change user_agent user_agent varchar(255) not null default "";
If it is indeed intended that
user_agent
should not be null/empty then the code needs to reflect this.The text was updated successfully, but these errors were encountered: