MySQL Create DB Script

Hello,

I wan´t to create a new Database of my existing Cuba Project on a MySql!
I get a connection to the MySql Databas but if I wanna Create or Update the Database I get the failure: Failed to execute: create table SYS_DB_CHANGELOG (SCRIPT_NAME varchar(300) not null primary key, CREATE_TS datetime default current_timestamp, IS_INIT integer default 0) because: Invalid default value for ‘CREATE_TS’

I have done the SQL-Statement by my own and I think it should work if you do the statement like this:
create table SYS_DB_CHANGELOG (SCRIPT_NAME varchar(255) not null primary key, CREATE_TS datetime, IS_INIT integer default 0);

Can you fix that in your Code? Or what can i do?

thanks
Kevin

1 Like

In the Platform version 6.2.0 added a support of MySQL 5.6 database.

There still seems to be a problem:


Download https://repo.cuba-platform.com/content/groups/work/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar
Table SYS_DB_CHANGELOG does not exist, running all init scripts
Failed to execute: create table SYS_DB_CHANGELOG (SCRIPT_NAME varchar(255) not null primary key, CREATE_TS datetime default current_timestamp, IS_INIT integer default 0) because: Specified key was too long; max key length is 767 bytes

If I execute the following statement:
SHOW VARIABLES LIKE “%version%”;

I see:

sql
innodb_version	5.6.31
protocol_version	10
slave_type_conversions	
version	5.6.31-log
version_comment	MySQL Community Server (GPL)
version_compile_machine	x86_64
version_compile_os	Linux

This is because unicode can be 4 bytes/character.

Hi, the fix will appear in next bugfix release. We’ll decrease the length of the primary key to support charsets with 4 bytes per character.

:ticket: See the following issue in our bug tracker:

https://youtrack.cuba-platform.com/issue/PL-8879