PHPCI
PHPCI copied to clipboard
Error on install: Syntax error or access violation: 1067 Invalid default value for 'end_time'
PHP 5.6.9RC1 mysql Ver 14.14 Distrib 5.7.7-rc, for Win64 (x86_64)
C:\work\phpci>php console phpci:install
******************
Welcome to PHPCI
******************
Checking requirements... OK
Please answer the following questions:
-------------------------------------
Please enter your MySQL host [localhost]:
Please enter your MySQL database name [phpci]:
Please enter your MySQL username [phpci]: root
Please enter your MySQL password:
PHPCI could not connect to MySQL with the details provided. Please try again.
SQLSTATE[HY000] [1049] Unknown database 'phpci'
Please enter your MySQL host [localhost]: 127.0.0.1
Please enter your MySQL database name [phpci]:
Please enter your MySQL username [phpci]: root
Please enter your MySQL password:
Your PHPCI URL ("http://phpci.local" for example): http://localhost:85
Setting up your database...
[InvalidArgumentException]
There was a problem creating the schema table: SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'end_time'
migrate [-c|--configuration="..."] [-p|--parser="..."] [-e|--environment="..."] [-t|--target="..."]
OK
Try running mysqld
with --explicit_defaults_for_timestamp=TRUE
As per the error message:
TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
See MySQL docs reference: https://dev.mysql.com/doc/refman/5.6/en/server-system-variables.html#sysvar_explicit_defaults_for_timestamp
I have the same problem. I try to run "sudo /usr/local/mysql/bin/mysqld --explicit_defaults_for_timestamp=FALSE" on my mac but the error is the same
Try running mysqld
with just --explicit_defaults_for_timestamp
. (remove =TRUE
or =FALSE
)
It should then allow for timestamp default values.
Or it would be great if the migrations just catered for this.
If I run mysqld
with just --explicit_defaults_for_timestamp
I get the following message
SQLSTATE[42000]: Syntax error or access violation: 1101 BLOB, TEXT, GEOMETRY or JSON
column 'log' can't have a default value
To fix that I had to edit a migrations file, and alter how the log
field was being added.
Can you remember which file it was?
Change PHPCI/Migrations/20150203105015_fix_column_types.php
to
1 <?php
2
3 use Phinx\Migration\AbstractMigration;
4 use Phinx\Db\Adapter\MysqlAdapter;
5
6 class FixColumnTypes extends AbstractMigration
7 {
8 /*
9 * Migrate Up.
10 */
11 public function up()
12 {
13 // Update the build log column to MEDIUMTEXT:
14 $build = $this->table('build');
15 $build->changeColumn('log', 'text', array(
16 'null' => true,
17 'limit' => MysqlAdapter::TEXT_MEDIUM,
18 ));
19
20 // Update the build meta value column to MEDIUMTEXT:
21 $buildMeta = $this->table('build_meta');
22 $buildMeta->changeColumn('meta_value', 'text', array(
23 'null' => false,
24 'limit' => MysqlAdapter::TEXT_MEDIUM,
25 ));
26 }
27 }
still the same error: SQLSTATE[42000]: Syntax error or access violation: 1101 BLOB, TEXT, GEOMETRY or JSON column 'log' can't have a default value
I had to change the file 20140730143702_fix_database_columns.php
and on line 23: $build->changeColumn('log', 'text', array('null' => true));
Now it works
It's there a PR for these fix already?
Not yet. In which branch should I put it?
Not sure why the PascalMinder commit 14f4e58 hasn't been merged yet but just in case I created a PR
https://github.com/Block8/PHPCI/pull/1205
Thanks!