# DocumentStore SQL localization resources specific to the MySQL
# Database implementation.

# The DDL statement is used to create the LocalDocumentStore
# table if it does not already exist.  Table creation and datatype syntax
# varies by database vendor.  The DDL may consist of several statements,
# so the DDL is specified as an EProperties list, where each list item
# is a separate SQL statement.  {0} will substitute as the table name.
table.create.ddl = ( "CREATE TABLE IF NOT EXISTS {0} ( ${column.timestamp} TIMESTAMP, ${column.feed_id} VARCHAR(32), ${column.snapshot_id} VARCHAR(16), ${column.action} VARCHAR(8), ${column.doc_id} VARCHAR(936) PRIMARY KEY NOT NULL, ${column.parent_id} VARCHAR(8000), ${column.container} VARCHAR(8000), ${column.message} VARCHAR(1024), ${column.custom1} VARCHAR(8000), ${column.custom2} VARCHAR(8000) )" )


# DocumentStore SQL localization resources specific to the MySQL
# Database implementation.

# MySQL suffers from severe limitation in the lengths of primary keys.
# If MySQL is configured to use InnoDB tables, the maximum key length is
# 767 bytes.  If using MyISAM tables, the maximum key length is 1000 bytes.
# The Documents Table uses the Connector's supplied DOCID as the primary
# key.  Connectors that supply long URLs or file system pathnames as DOCIDs
# could theoretically exceed the maximum key length.  Be aware that using
# InnoDB tables would not be recommeneded in this environment.
# From the MySQL documentation:
# "In InnoDB tables, having a long PRIMARY KEY wastes a lot of space."
# If using MyISAM tables, you could increase this mysql.max.key.len property
# to 1000 bytes.
mysql.max.key.len=767

# The DDL statement is used to create the LocalDocumentStore
# table if it does not already exist.  Table creation and datatype syntax
# varies by database vendor.  The DDL may consist of several statements,
# so the DDL is specified as an EProperties list, where each list item
# is a separate SQL statement.  {0} will substitute as the table name.
table.create.ddl = ( "CREATE TABLE IF NOT EXISTS {0} ( ${column.timestamp} TIMESTAMP, ${column.feed_id} VARCHAR(32), ${column.snapshot_id} VARCHAR(16), ${column.action} VARCHAR(8), ${column.doc_id} VARCHAR(${mysql.max.key.len}) PRIMARY KEY NOT NULL, ${column.parent_id} VARCHAR(8000), ${column.container} VARCHAR(8000), ${column.message} VARCHAR(1024), ${column.custom1} VARCHAR(8000), ${column.custom2} VARCHAR(8000) )" )


Fix the PRIMARY KEY length for the Documents Table DDL for MySQL. If MySQL is configured to use InnoDB tables, the maximum key length is 767 bytes. If using MyISAM tables, the maximum key length is 1000 bytes. This change drops the PRIMARY KEY size to the lesser of the two (767) to avoid the error: “Specified key was too long; max key length is 767 bytes”
Fix the PRIMARY KEY length for the Documents Table DDL for MySQL.
If MySQL is configured to use InnoDB tables, the maximum key
length is 767 bytes.  If using MyISAM tables, the maximum key
length is 1000 bytes.  This change drops the PRIMARY KEY size
to the lesser of the two (767) to avoid the error:
“Specified key was too long; max key length is 767 bytes”

The Documents Table uses the Connector's supplied DOCID as the primary
key.  Connectors that supply long URLs or file system pathnames as DOCIDs
could theoretically exceed the maximum key length.  Be aware that using
InnoDB tables would not be recommeneded in this environment.
From the MySQL documentation:
"In InnoDB tables, having a long PRIMARY KEY wastes a lot of space."

Change Log:
----------
M  connector-manager/source/resources/sql/connector-manager/DocumentStore_mysql.properties

Code Review:
-----------
http://codereview.appspot.com/4271072

