Skip to content
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

Cannot Creating User #88

Closed
mimikun opened this issue Apr 4, 2019 · 9 comments

Comments

@mimikun
Copy link

commented Apr 4, 2019

Describe the bug

I was creating user in shell.
but, an error occurred.

Log:

hostname:~/writefreely$ ./writefreely -create-user user-name:pass_word

2019/04/04 12:10:43 Loading config.ini configuration...
2019/04/04 12:10:43 Connecting to mysql database...
2019/04/04 12:10:44 Creating user user-name...
ERROR: 2019/04/04 12:10:44 log.go:26: Rolling back users INSERT: Error 1364: Field 'created' doesn't have a default value
2019/04/04 12:10:44 Closing database connection...
ERROR: 2019/04/04 12:10:44 log.go:26: Unable to create user: Error 1364: Field 'created' doesn't have a default value

Steps to reproduce (if necessary)

Steps to reproduce the behavior:

  1. run ./writefreely -create-user user-name:pass_word

Application configuration

  • Single mode or Multi-user mode? Multi-user mode
  • Database? mysql
  • Open registration? no
  • Federation enabled? yes

Version or last commit:

  • v0.8.1
@thebaer

This comment has been minimized.

Copy link
Member

commented Apr 4, 2019

Which version of MySQL are you running? I believe this will happen in v5.5 or earlier.

@mimikun

This comment has been minimized.

Copy link
Author

commented Apr 4, 2019

I using MySQL 5.7.
mysql vesrion:
mysql Ver 14.14 Distrib 5.7.25, for Linux (x86_64) using EditLine wrapper

@mrvdb

This comment has been minimized.

Copy link
Collaborator

commented Apr 4, 2019

Possibly similar situation as in #60 ?

@thebaer

This comment has been minimized.

Copy link
Member

commented Apr 4, 2019

Hmm, yeah I'd say so. @mimikun are you building from source or using the compiled version we release? Maybe schema.sql is out of date? This is the important line that should prevent the error you're seeing: https://github.com/writeas/writefreely/blob/v0.8.1/schema.sql#L227

@mimikun

This comment has been minimized.

Copy link
Author

commented Apr 5, 2019

I'm using a released compiled version.
my schema.sql is here.

Should I update schema.sql and run writefreely -migrate?

@thebaer

This comment has been minimized.

Copy link
Member

commented Apr 5, 2019

Okay, if it's our release it'll use the embedded schema.sql. So I assume you're upgrading from a previous version? If so, this is similar to #60 and not a bug.

To fix this, you'll have to manually update the database:

ALTER TABLE `users` CHANGE `created` `created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP;
ALTER TABLE `accesstokens` CHANGE `created` `created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP;

I think that should cover everything, but let me know if anything still isn't working.

@thebaer

This comment has been minimized.

Copy link
Member

commented Apr 6, 2019

Closing this now, since it doesn't appear to be a bug. But feel free to continue discussing here.

@thebaer thebaer closed this Apr 6, 2019

@mimikun

This comment has been minimized.

Copy link
Author

commented Apr 6, 2019

I solved the way.
thanks!

@thebaer

This comment has been minimized.

Copy link
Member

commented Apr 7, 2019

Awesome! No problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.