1

I'm using the following code to create a database schema using the .install file in drupal-6

function myModule_install() {
  // Create tables.
  drupal_install_schema('table_name');

}

Let's say, the myModule = 'abc' & table_name = 'sim_table'; this is working good with the same table name as the module name but my requirement is different then that: I need to create a table name with a different prefix, like "drupal_sim_table", so I am using this code instead drupal_install_schema('sim_table');

but it's not working at all. The module gets installed but tables are not created. I have been trying so many times without success.

1 Answer 1

2

In short:

function mymodule_schema() {
  $schema = array();
  $schema['my_table_name'] = array(
  );
  return $schema;
}

function mymodule_install() {
  drupal_install_schema('mymodule');
}

which means, in drupal_install_schema() you use your module name, but then in hook_schema() in $schema definition you can use whatever table name you want.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.