Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Hosting Requirements /

What you need to consider when choosing a hosting provider and plan.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Silverstripe 3.1 and MySQL table type InnoDB


Go to End
Reply


3 Posts   1646 Views

Avatar
ramtamtam

Community Member, 5 Posts

25 April 2014 at 1:07am

Hi,

i am running Silverstripe 3.1 on a hosted webserver that only supports table type MyISAM. Every time i run a dev/build Silverstripe tries to change the table type to InnoDB. Apparently it does not succeede, because next time i run dev/build, it tries again.
I am wondering if this can cause any problems in the usage of Silverstripe. As far as i know transactions are supported only with InnoDB. In case the usage of MyISAM will not cause any problems, can i configure Silverstripe in a way that it does not try to change the table type?

I know, there SHOULD be posts about this, but i could not find anything helpful.

Thanx for your help!
Funz3l

Avatar
ramtamtam

Community Member, 5 Posts

29 April 2014 at 7:50pm

Edited: 29/04/2014 7:54pm

... so i guess i just give it a try, because

  • server requirements for 3.1 do not say InnoDB is mandatory and

  • changelogs for 3.0.0 suggest that in order to use full text search one has to change default table type from innoDB to MyISAM by inserting

    DataObject::$create_table_options['MySQLDatabase'] = 'ENGINE=MyISAM';

    into _config.php. As visibility of $create_table_options apparently was changed to private later on, the only way i see is to change this setting in DataObject.php directly. Not nice, i know. But it seems to work as a dev/build now does not attempt to change table type.

I hope i do not run into problems with mysql foreign key constraint.

Avatar
tony13tv

Community Member, 1 Post

8 March 2016 at 4:47pm

Maybe late but if anyone can find it useful, this will change engine for all relevant tables:

Create an extension:

<?php
class MyISAMExtension extends Extension {
    private static $create_table_options = array(
        'MySQLSchemaManager' => 'ENGINE=MyISAM'
    );
}

Add the extension to DataObject class:

DataObject:
  extensions:
    - MyISAMExtension

or

 DataObject::add_extension('DataObject', 'MyISAMExtension');