Recently I downloaded some free extensions in magento CE 1.7. One of them had a data folder inside the module folder structure. It contained some data upgrade scripts. At the same time the module had sql folder as well. It also contained one install script and several upgrade scripts. Can anyone clarify why the same module has two folders to keep scripts? What is the difference of data scripts and sql scripts?

Any suggestion would be highly appreciated.

  • 1
    The data folder scripts can be used to insert entities in the tables. Also, you should use this if you need the config fully loaded when executing an upgrade script. The config is not fully loaded when executing scripts from the sql folder.
    – Marius
    Commented Sep 26, 2013 at 17:03

1 Answer 1


The data folder was introduced in Magento CE 1.6 and EE 1.11. The idea is to split the data structure and the data (insertion).

They work in the same way as install scripts.

Example: If you need to create a new table and fill it with data, you would put the table creation in your sql folder (install- or upgrade-script). Inserting the data into the table would be done in the data folder (install- or upgrade-script).

Edit (to complete the answer according to the comments of Marius and Fabian): The setup scripts in the sql folder are executed in an earlier state, so the config is not fully loaded.

  • Thank you so much. I checked the scripts. They seems to be coded like that. And I checked the database so I could able to figured out that existing table has added new columns with data.
    – Sukeshini
    Commented Sep 26, 2013 at 17:00
  • Anna, can you have a look on the comment from Marius? It is important, that it is not the same. sql is executed earlier (e.g. before store initialization) and dataafter everything is loaded and configured. Commented Sep 26, 2013 at 18:36
  • 2
    @FabianBlechschmidt you're right. I forgot to focus on the time of execution. There's a nice answer form benmarks here: magento.stackexchange.com/a/3106/231 Commented Sep 26, 2013 at 20:03
  • @Su123 pleaes see my comment above. Commented Sep 26, 2013 at 20:08
  • @Anna Völkl : Thank you for the link provided. I referred it and got a detailed explanation on this.
    – Sukeshini
    Commented Sep 27, 2013 at 3:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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