I am developing an extension that will be probably used by 1000+ stores and needs to add 1 extra field into table sales_flat_order.

ALTER TABLE `".$obj->getTable('sales_flat_order')."` 
               ADD `new_field` TINYINT NULL DEFAULT NULL

sales_flat_order is very important table I am wondering if there ANY risk with this operation? If there is any even tiny risk for that, than I will rather create extra table with fields order_id | new_field.


  • Nope, this is not question how to add custom fields to sales_flat_order, it is question how safe is to use alter table for sales_flat_order. – JohnyFree May 27 '16 at 9:16
  • @Raphael at Digital Pianism ,i did not thought it duplicate question,bcoz of user asking the question for is there any risk of add a columns ta order table.Does not ask abound how a columns will add to sales – Amit Bera May 27 '16 at 15:50

I don't think there would be any issues, just make sure the upgrade script uses addColumn or addAttribute instead of a raw SQL query (as its considered bad practice).

| improve this answer | |

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