WriteFreely requires MySQL version newer than 5.5

As CentOS still ships MariaDB 5.5, some users might still have an issue initializing WriteFreely's schema.sql.

Running:

./writefreely --init-db

returns following including errors:

2019/03/02 02:14:49 Loading config.ini configuration...
2019/03/02 02:14:49 Connecting to mysql database...
2019/03/02 02:14:49 Creating table accesstokens...
ERROR: 2019/03/02 02:14:49 log.go:26: Error 1067: Invalid default value for 'created'
2019/03/02 02:14:49 Creating table appcontent...
ERROR: 2019/03/02 02:14:49 log.go:26: Error 1067: Invalid default value for 'updated'
2019/03/02 02:14:49 Creating table appmigrations...
2019/03/02 02:14:49 Created.
2019/03/02 02:14:49 Creating table collectionattributes...
2019/03/02 02:14:49 Created. 2019/03/02 02:14:49
Creating table collectionkeys...
2019/03/02 02:14:49 Created.
2019/03/02 02:14:49 Creating table collectionpasswords...
2019/03/02 02:14:49 Created. 2019/03/02 02:14:49
Creating table collectionredirects...
2019/03/02 02:14:49 Created.
2019/03/02 02:14:49 Creating table collections...
2019/03/02 02:14:49 Created.
2019/03/02 02:14:49 Creating table posts...
ERROR: 2019/03/02 02:14:49 log.go:26: Error 1293: Incorrect table definition; there can be only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT or ON UPDATE clause
2019/03/02 02:14:49 Creating table remotefollows...
2019/03/02 02:14:49 Created.
2019/03/02 02:14:49 Creating table remoteuserkeys...
2019/03/02 02:14:49 Created.
2019/03/02 02:14:49 Creating table remoteusers...
2019/03/02 02:14:49 Created.
2019/03/02 02:14:49 Creating table userattributes...
2019/03/02 02:14:49 Created.
2019/03/02 02:14:49 Creating table userinvites...
2019/03/02 02:14:49 Created.
2019/03/02 02:14:49 Creating table users...
ERROR: 2019/03/02 02:14:49 log.go:26: Error 1067: Invalid default value for 'created'
2019/03/02 02:14:49 Creating table usersinvited...
2019/03/02 02:14:49 Created.
2019/03/02 02:14:49 Updating appmigrations table...
2019/03/02 02:14:49 Done.

In my initial installation on fedi.dev I have modified tables accesstokens, appcontent, posts and users to match MariaDB 5.5 requirements, but probably it makes no sense request them pulled as newer MariaDB/MySQL versions doesn't need any modifications to original schema.sql.

I can confirm that with MariaDB 10.x there are no issues – tables gets created successfully.

There is an issue already registered on GitHub where I also replied with these details.

Tags: #server #writefreely #writeas #golang