0

I am trying to install a Magento extension manually by uploading the file directly and bypassing the "magento connect". the problem is that I get an error when I'm on the backend as what tables and fields have not been created.

how do I create tables in the database?

  • 1
    if your extension is using custom tables, then if your extension is properly configured, then magento will automtically create table when any of the page loads – Rajeev K Tomy Sep 18 '14 at 10:01
  • ok and Is it possible to create the tables manually using the sql folder of an extension? – strauss Sep 18 '14 at 10:06
  • 1
    You should not create the tables manually. If they're not created by the setup script itself, this is a sign of a not properly installed extension. – Anna Völkl Sep 18 '14 at 10:40
3

Every time when a page loads As @fabian commented out, Every time magento merges the config, Magento will look for any new modules is configured with the system. It uses versioning for check this. If you take a look on the configuration file of any module, you can see the below code there.

File: app/code/<codePool>/<Namespace>/<Modulename>/etc/config.xml

<modules>
    <Namespace_Modulename>
          <version>1.0.0</version>
    </Namespace_Modulename>
</modules>

Here 1.0.0 is the version number of this module. Magento will keep this version number in it's database. Take a look on the table core_resource table. There magento holds all module's version number.

Now when a page loads, Magento look for any new modules configured with the system. Magento will use information that is provided inside app/etc/modules/<Namepace_Modulename>.xml file recognize new modules. Then magento check new module's version number and stores in core_resource table. Then it will use this version number for checking for valid install/update scripts. Install/update scripts holds sql quries to interact with database. An install script names like this. install-1.0.0.php. See you can see that it uses version number in it's name. Magento will only execute those files which has a version number equal or higher to the version number that is specified inside of that module's config.xml.

Once an install script executed based on its version number, it will not execute again. Why ? This is because, magento will check version number in config file with version number that is stored in core_resource file. If those version number matches, then it means module didn't upgraded, hence it will not look for install/update scripts.

So if you want to use the same install script file of the module again, usually you can use two approaches

  1. Increase the version number inside config.xml and change the install script name according to that version number. For example, if you increased above module's version number to 1.0.1.1, then you need to change the name of install script to install-1.0.0.1.1.php. So when a page request takes place, magento will notice that our module's version number has changed and hence look for install script to execute.

  2. Delete entry correspond to our module from core_resource file and then delete the tables that is created by our modules. Since this make no entry inside data table correspond to our module, when page request takes place, magento will treat our module as a "newbie" and hence execute the installation script.

Normally I use the second method during development. However for you first one would be good.

Refer these links. It will give you much more idea on this. LINK1 LINK2

| improve this answer | |
  • 1
    You forgot the most important part it is not Every time when a page loads but every time magento merges the config, so when the cache is on, nothing happens - which I think is the problem here – Fabian Blechschmidt Sep 28 '14 at 14:08
  • @FabianBlechschmidt : Be honest, when I was preparing this answer, my mind was working in developing mode. That is why the answer turned like this. It was a big mistake. Thanks for notifying me.. :-) – Rajeev K Tomy Sep 29 '14 at 8:40
  • Oh yea, what a big mistake. Sorry to not pointing out, this was meant funny. Your answer is great :-) – Fabian Blechschmidt Sep 29 '14 at 18:23
  • @FabianBlechschmidt : this answer is great because, you people are great. :-) – Rajeev K Tomy Sep 29 '14 at 18:25
  • we people, @programmer_rkt, WE. – Fabian Blechschmidt Sep 29 '14 at 18:26

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.