0

I am trying to make a collate change (DEFAULT CHARSET=utf8 COLLATE utf8_general_ci) to db but not sure how? (magento1.9)

<?php
$installer = $this;
$installer->startSetup();

$installer->getConnection()

// how to do collate change here?

Help much appreciated,

Thanks G

0

You can run a SQL query in your install script:

$installer->run("ALTER TABLE `{$this->getTable('your/table')}` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;");

Edit:

I think there is no built-in method to change tables charset. There is only a method to change columns ...

$installer->getConnection()->changeColumn($tableName, $oldColumnName, $newColumnName, $definition);

Example from magento update script:

$installer->getConnection()->changeColumn($this->getTable('sales_flat_quote_item'),
    'weee_tax_applied', 'weee_tax_applied',
    'text CHARACTER SET utf8'
);
  • Hi @sv3n thanks that is what I currently have but we are looking for a "Zend-esque"/ORM way of doing it (if possible) – gvanto Mar 22 '18 at 12:23
  • 1
    @gvanto as far as i know there is no Varien/Zend/Magento method to achieve this. – sv3n Mar 22 '18 at 12:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.