{"action":"created","issue":{"url":"https://api.github.com/repos/revive-adserver/revive-adserver/issues/740","repository_url":"https://api.github.com/repos/revive-adserver/revive-adserver","labels_url":"https://api.github.com/repos/revive-adserver/revive-adserver/issues/740/labels{/name}","comments_url":"https://api.github.com/repos/revive-adserver/revive-adserver/issues/740/comments","events_url":"https://api.github.com/repos/revive-adserver/revive-adserver/issues/740/events","html_url":"https://github.com/revive-adserver/revive-adserver/issues/740","id":166671240,"number":740,"title":"Installation failed to create the core tables","user":{"login":"pteague","id":731839,"avatar_url":"https://avatars.githubusercontent.com/u/731839?v=3","gravatar_id":"","url":"https://api.github.com/users/pteague","html_url":"https://github.com/pteague","followers_url":"https://api.github.com/users/pteague/followers","following_url":"https://api.github.com/users/pteague/following{/other_user}","gists_url":"https://api.github.com/users/pteague/gists{/gist_id}","starred_url":"https://api.github.com/users/pteague/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pteague/subscriptions","organizations_url":"https://api.github.com/users/pteague/orgs","repos_url":"https://api.github.com/users/pteague/repos","events_url":"https://api.github.com/users/pteague/events{/privacy}","received_events_url":"https://api.github.com/users/pteague/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-07-20T20:13:45Z","updated_at":"2016-07-24T16:58:51Z","closed_at":null,"body":"Installing Revive Adserver 3.2.4 (the tar.gz from the project's site download page & the master branch)\r\n\r\nDuring the database part fill in database information. Select MySQL & ISAM or InnoDB for table type. Click \"Continue >>\" and after a short period of time a red warning shows up stating \"Installation failed to create the core tables\".\r\n\r\nChecking the var/debug.log it specifically states:\r\n\r\nJul 20 12:07:19 -0500 OX-578fafc290e07 [    error]  _doQuery: [Error message: Could not execute statement]\r\n[Last executed query: CREATE TABLE `rv_application_variable` (`name` VARCHAR(255) DEFAULT '' NOT NULL, `value` TEXT NOT NULL, PRIMARY KEY (name)) ENGINE = INNODB]\r\n[Native code: 1071]\r\n[Native message: Specified key was too long; max key length is 767 bytes]\r\n\r\nThis is an issue with both MySQL & MariaDB as the index on a VARCHAR(255) is to large. I don't remember when this feature was first introduced, but I've tested against both of the following:\r\n\r\nMySQL 5.5.46-0ubuntu0.14.04.2\r\nMariaDB 10.0.25-MariaDB-0ubuntu0.16.04.1\r\n\r\nBased on [lib/max/Dal/DataObjects/db_schema.ini](https://github.com/revive-adserver/revive-adserver/blob/master/lib/max/Dal/DataObjects/db_schema.ini#L137) and the variable comment for $name in [lib/max/Dal/DataObjects/Application_variable.php](https://github.com/revive-adserver/revive-adserver/blob/master/lib/max/Dal/DataObjects/Application_variable.php#L24) it looks like the name field should only be 130 characters long? I manually rewrote the create table query so that name is a VARCHAR(130) & it works for both databases:\r\n\r\nCREATE TABLE `rv_application_variable` (`name` VARCHAR(130) DEFAULT '' NOT NULL, `value` TEXT NOT NULL, PRIMARY KEY (name)) ENGINE = INNODB\r\n\r\nI've spent a good portion of the day trying to figure out how exactly it creates the tables and I'm still not sure what I'm missing. Just as some ideas as to how to fix this I've changed the VARCHAR(255) to VARCHAR(130) in the $name comments. I changed [etc/tables_core.xml](https://github.com/revive-adserver/revive-adserver/blob/master/etc/tables_core.xml#L911) `<length>255</length>` field to `<length>130</length>` and cleared out all the cache & template files in var/cache & var/templates_compiled. I looked at [etc/changes/EncodingMigration.php](https://github.com/revive-adserver/revive-adserver/blob/master/etc/changes/EncodingMigration.php#L78), but there doesn't seem to be a way to set a VARCHAR length there. I went through all of the files in etc/changes/ that mentioned the table & changed the `<length/>` value for name to be 130. I also grep'ed the entire project for \"CREATE TABLE\", but other than table copies in lib/OA/Upgrade/(DB_Upgrade.php|Migration.php|Upgrade.php) and the expected ones in lib/pear/DB & lib/pear/MDB2.\r\n\r\nThere are 2 similar issues posted in the forums with a response for more information and no reply."},"comment":{"url":"https://api.github.com/repos/revive-adserver/revive-adserver/issues/comments/234788465","html_url":"https://github.com/revive-adserver/revive-adserver/issues/740#issuecomment-234788465","issue_url":"https://api.github.com/repos/revive-adserver/revive-adserver/issues/740","id":234788465,"user":{"login":"pteague","id":731839,"avatar_url":"https://avatars.githubusercontent.com/u/731839?v=3","gravatar_id":"","url":"https://api.github.com/users/pteague","html_url":"https://github.com/pteague","followers_url":"https://api.github.com/users/pteague/followers","following_url":"https://api.github.com/users/pteague/following{/other_user}","gists_url":"https://api.github.com/users/pteague/gists{/gist_id}","starred_url":"https://api.github.com/users/pteague/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pteague/subscriptions","organizations_url":"https://api.github.com/users/pteague/orgs","repos_url":"https://api.github.com/users/pteague/repos","events_url":"https://api.github.com/users/pteague/events{/privacy}","received_events_url":"https://api.github.com/users/pteague/received_events","type":"User","site_admin":false},"created_at":"2016-07-24T16:58:50Z","updated_at":"2016-07-24T16:58:50Z","body":"Ok, here's a temporary solution as I don't know how to compile or override\nthe cached binary files... (this works for me for both MariaDB & MySQL I\nlisted above).\n\n1. open\n[etc/tables_core.xml](https://github.com/revive-adserver/revive-adserver/blob/master/etc/tables_core.xml#L911)\nand change the application_variable table's name field to have a\n`<length>130</length>`.\n\n2. rename `etc/xmlcache` & `etc/permanentcache` to something else (maybe\njust append .bak so you'll have them if you need them again later).\n\n3. fill in the Database server section during the install... This should\nallow the database to have a small enough size for the max key length on\nthat field.\n\n\n\nOn Thu, July 21, 2016 12:14 am, Matteo Beccati wrote:\n> It seems like your default charset might be `utfmb4`:\n>\n> http://stackoverflow.com/questions/6172798/mysql-varchar255-utf8-is-too-long-for-key-but-max-length-is-1000-bytes\n>\n> As of now, my suggestion is to use the good old utf8 instead, but this\n> deserves some more investigation.\n>\n>\n> ---\n> You are receiving this because you authored the thread.\n> Reply to this email directly or view it on GitHub:\n> https://github.com/revive-adserver/revive-adserver/issues/740#issuecomment-234158688\n\n\n"}}
{"actor":{"display_login":"pteague"}}