2
我在依賴於實體api的drupal 7.15中創建了一個模塊。 我的模塊名稱是員工 我已創建employee.info文件以及employee.install文件。 但在數據庫中,我無法在employee.install文件中看到自己創建的數據庫模式。 這是我的.info文件和.install文件分別編輯 :在自定義模塊創建中如何在drupal 7.15中查看基本數據庫表
name = Employee Management
description = A module that describes about the employee management
core = 7.x
package = Employee management module
files[] = employee.module
編輯:
<?php
/**
* @file
* Install for a employee entity - need to create the base table for our entity.
* This table can have as many colums as you need to keep track of entity-specific
* data that will not be added via attached fields.
* The minimum information for the entity to work is an id and an entity name.
*/
/**
* Implements hook_schema()
*/
function employee_schema() {
$schema = array();
$schema['employee'] = array(
'description' => 'The base table for employee entity.',
'fields' => array(
'employee_id' => array(
'description' => 'Primary Key: Identifier for a employee entity.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'first_name' => array(
'description' => 'The First name of employee entity.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'last_name' => array(
'description' => 'The Last name of employee entity.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'employee_add' => array(
'description' => 'The address of employee entity.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'employee_doj' => array(
'description' => 'The address of employee entity.',
'type' => 'date',
'not null' => TRUE,
'default' => '',
),
),
'primary key' => array('employee_id'),
);
return $schema;
}