开发者

Drupal 6 module install file not creating tables in database with Different table name

开发者 https://www.devze.com 2023-04-11 08:18 出处:网络
I\'m using the following code to create a database schema using the .install file in drupal-6 function myModule_install() {

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开发者_JS百科 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号