MySQL error: Specified key was too long; max key length is 767 bytes
Hi, I'm initializing repository this way:
```
JaversSqlRepository sqlRepository = SqlRepositoryBuilder.sqlRepository()
	.withConnectionProvider(connectionProvider)
	.withDialect(DialectName.MYSQL)
	.build();
Javers javers = JaversBuilder.javers().registerJaversRepository(sqlRepository).build();
```
however I get an error in the application:

```
13:22:18,689  INFO SqlRepositoryBuilder:55 - starting up SQL repository module ...
13:22:18,719  INFO Java8AddOns:13 - loading Java8 add-ons ...
13:22:18,738  INFO ScannerModule:28 - using FIELD mappingStyle
13:22:18,753  INFO JaversSchemaManager:244 - creating javers table jv_commit_property ...
13:22:18,753  INFO SchemaManagerImpl:51 - creating entity with name jv_commit_property using ddl:
CREATE TABLE jv_commit_property (
property_name VARCHAR(200),
property_value VARCHAR(200),
commit_fk BIGINT,
CONSTRAINT jv_commit_property_pk PRIMARY KEY(commit_fk, property_name),
CONSTRAINT jv_commit_property_commit_fk FOREIGN KEY(commit_fk) REFERENCES jv_commit(commit_pk)
) ENGINE = InnoDB
13:22:18,755  WARN RequestCycleExtra:346 - ********************************
13:22:18,755  WARN RequestCycleExtra:347 - Handling the following exception
org.polyjdbc.core.exception.SchemaManagerException: [DDL_ERROR] Failed to run DDL:
CREATE TABLE jv_commit_property (
property_name VARCHAR(200),
property_value VARCHAR(200),
commit_fk BIGINT,
CONSTRAINT jv_commit_property_pk PRIMARY KEY(commit_fk, property_name),
CONSTRAINT jv_commit_property_commit_fk FOREIGN KEY(commit_fk) REFERENCES jv_commit(commit_pk)
) ENGINE = InnoDB
	at org.polyjdbc.core.schema.SchemaManagerImpl.ddl(SchemaManagerImpl.java:91)
	at org.polyjdbc.core.schema.SchemaManagerImpl.create(SchemaManagerImpl.java:52)
	at org.javers.repository.sql.schema.JaversSchemaManager.ensureTable(JaversSchemaManager.java:245)
	at org.javers.repository.sql.schema.JaversSchemaManager.ensureSchema(JaversSchemaManager.java:42)
	at org.javers.repository.sql.JaversSqlRepository.ensureSchema(JaversSqlRepository.java:81)
	at org.javers.core.JaversBuilder.build(JaversBuilder.java:107)
	at cz.jaclean.pages.TestPage.onInitialize(TestPage.java:56)
	at org.apache.wicket.Component.fireInitialize(Component.java:891)
	at org.apache.wicket.MarkupContainer.internalInitialize(MarkupContainer.java:1081)
	at org.apache.wicket.Page.isPageStateless(Page.java:465)
	at org.apache.wicket.request.handler.render.WebPageRenderer.isPageStateless(WebPageRenderer.java:287)
	at org.apache.wicket.request.handler.render.WebPageRenderer.shouldRenderPageAndWriteResponse(WebPageRenderer.java:329)
	at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:193)
	at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175)
	at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:895)
	at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
	at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265)
	at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222)
	at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293)
	at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261)
	at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:203)
	at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:284)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
	at org.eclipse.jetty.server.Server.handle(Server.java:523)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
	at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:560)
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:537)
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:527)
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:115)
	at com.mysql.cj.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2011)
	at com.mysql.cj.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:1964)
	at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:891)
	at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:795)
	at com.mchange.v2.c3p0.impl.NewProxyStatement.execute(NewProxyStatement.java:75)
	at org.polyjdbc.core.schema.SchemaManagerImpl.ddl(SchemaManagerImpl.java:88)
	... 44 more
13:22:18,757  WARN RequestCycleExtra:348 - ********************************
13:22:18,758 ERROR DefaultExceptionMapper:170 - Unexpected error occurred
org.polyjdbc.core.exception.SchemaManagerException: [DDL_ERROR] Failed to run DDL:
CREATE TABLE jv_commit_property (
property_name VARCHAR(200),
property_value VARCHAR(200),
commit_fk BIGINT,
CONSTRAINT jv_commit_property_pk PRIMARY KEY(commit_fk, property_name),
CONSTRAINT jv_commit_property_commit_fk FOREIGN KEY(commit_fk) REFERENCES jv_commit(commit_pk)
) ENGINE = InnoDB
	at org.polyjdbc.core.schema.SchemaManagerImpl.ddl(SchemaManagerImpl.java:91)
	at org.polyjdbc.core.schema.SchemaManagerImpl.create(SchemaManagerImpl.java:52)
	at org.javers.repository.sql.schema.JaversSchemaManager.ensureTable(JaversSchemaManager.java:245)
	at org.javers.repository.sql.schema.JaversSchemaManager.ensureSchema(JaversSchemaManager.java:42)
	at org.javers.repository.sql.JaversSqlRepository.ensureSchema(JaversSqlRepository.java:81)
	at org.javers.core.JaversBuilder.build(JaversBuilder.java:107)
	at cz.jaclean.pages.TestPage.onInitialize(TestPage.java:56)
	at org.apache.wicket.Component.fireInitialize(Component.java:891)
	at org.apache.wicket.MarkupContainer.internalInitialize(MarkupContainer.java:1081)
	at org.apache.wicket.Page.isPageStateless(Page.java:465)
	at org.apache.wicket.request.handler.render.WebPageRenderer.isPageStateless(WebPageRenderer.java:287)
	at org.apache.wicket.request.handler.render.WebPageRenderer.shouldRenderPageAndWriteResponse(WebPageRenderer.java:329)
	at org.apache.wicket.request.handler.render.WebPageRenderer.respond(WebPageRenderer.java:193)
	at org.apache.wicket.core.request.handler.RenderPageRequestHandler.respond(RenderPageRequestHandler.java:175)
	at org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:895)
	at org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64)
	at org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265)
	at org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222)
	at org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293)
	at org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261)
	at org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:203)
	at org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:284)
	at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1668)
	at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:581)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
	at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
	at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226)
	at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180)
	at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:511)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
	at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134)
	at org.eclipse.jetty.server.Server.handle(Server.java:523)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:273)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
	at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148)
	at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.sql.SQLSyntaxErrorException: Specified key was too long; max key length is 767 bytes
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:560)
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:537)
	at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:527)
	at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:115)
	at com.mysql.cj.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2011)
	at com.mysql.cj.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:1964)
	at com.mysql.cj.jdbc.StatementImpl.executeInternal(StatementImpl.java:891)
	at com.mysql.cj.jdbc.StatementImpl.execute(StatementImpl.java:795)
	at com.mchange.v2.c3p0.impl.NewProxyStatement.execute(NewProxyStatement.java:75)
	at org.polyjdbc.core.schema.SchemaManagerImpl.ddl(SchemaManagerImpl.java:88)
	... 44 more
```

When I try to run DDL  separately in the database:

```
CREATE TABLE jv_commit_property (
property_name VARCHAR(200),
property_value VARCHAR(200),
commit_fk BIGINT,
CONSTRAINT jv_commit_property_pk PRIMARY KEY(commit_fk, property_name),
CONSTRAINT jv_commit_property_commit_fk FOREIGN KEY(commit_fk) REFERENCES jv_commit(commit_pk)
) ENGINE = InnoDB
```

I get the same error..

As you do not specify encoding and my database used utf16_czech_ci collation, this maxed out allowed 767 bytes for a key size. After setting it to utf8_czech_ci, the problem went away.
Either it would be good to specify encoding or check encoding first and then set a limit on a key.

Related discussions: 
[#1071 - Specified key was too long; max key length is 767 bytes](http://stackoverflow.com/questions/1814532/1071-specified-key-was-too-long-max-key-length-is-767-bytes)
[UTF8, UTF16, and UTF32](http://stackoverflow.com/questions/496321/utf8-utf16-and-utf32)
diff --git a/javers-persistence-sql/src/main/java/org/javers/repository/sql/schema/FixedSchemaFactory.java b/javers-persistence-sql/src/main/java/org/javers/repository/sql/schema/FixedSchemaFactory.java
index 7aac9530..f3d77fc0 100644
--- a/javers-persistence-sql/src/main/java/org/javers/repository/sql/schema/FixedSchemaFactory.java
+++ b/javers-persistence-sql/src/main/java/org/javers/repository/sql/schema/FixedSchemaFactory.java
@@ -110,7 +110,7 @@ public class FixedSchemaFactory extends SchemaNameAware {
         RelationBuilder relationBuilder = schema.addRelation(tableName.nameWithSchema());
         relationBuilder
             .primaryKey(tableName.localName() + "_pk").using(COMMIT_PROPERTY_COMMIT_FK, COMMIT_PROPERTY_NAME).and()
-            .withAttribute().string(COMMIT_PROPERTY_NAME).withMaxLength(200).and()
+            .withAttribute().string(COMMIT_PROPERTY_NAME).withMaxLength(190).and()
             .withAttribute().string(COMMIT_PROPERTY_VALUE).withMaxLength(600).and();
         foreignKey(tableName, COMMIT_PROPERTY_COMMIT_FK, getCommitTableNameWithSchema(), COMMIT_PK, relationBuilder);
         relationBuilder.build();
@@ -136,7 +136,7 @@ public class FixedSchemaFactory extends SchemaNameAware {
         RelationBuilder relationBuilder = schema.addRelation(tableName.nameWithSchema());
         primaryKey(GLOBAL_ID_PK, schema,relationBuilder);
         relationBuilder
-                .withAttribute().string(GLOBAL_ID_LOCAL_ID).withMaxLength(200).and()
+                .withAttribute().string(GLOBAL_ID_LOCAL_ID).withMaxLength(190).and()
                 .withAttribute().string(GLOBAL_ID_FRAGMENT).withMaxLength(200).and()
                 .withAttribute().string(GLOBAL_ID_TYPE_NAME).withMaxLength(200).and();
         foreignKey(tableName, GLOBAL_ID_OWNER_ID_FK, getGlobalIdTableNameWithSchema(), GLOBAL_ID_PK, relationBuilder);
['javers-persistence-sql/src/main/java/org/javers/repository/sql/schema/FixedSchemaFactory.java']