drupal 创建数据库
2013-02-04 16:09
183 查看
1,在安装模块里面创建文件
例如:模块名称为 myblog
myblog.install
2,在文件中添加如下代码
例如:模块名称为 myblog
myblog.install
2,在文件中添加如下代码
<?php function myblog_schema() { $schema['myblog_project'] = array( 'description' => 'Update information for project translations.', 'fields' => array( 'name' => array( 'description' => 'A unique short name to identify the project.', 'type' => 'varchar', 'length' => '50', 'not null' => TRUE, ), 'project_type' => array( 'description' => 'Project type, may be core, module, theme', 'type' => 'varchar', 'length' => '50', 'not null' => TRUE, ), 'core' => array( 'description' => 'Core compatibility string for this project.', 'type' => 'varchar', 'length' => '128', 'not null' => TRUE, 'default' => '', ), 'version' => array( 'description' => 'Human readable name for project used on the interface.', 'type' => 'varchar', 'length' => '128', 'not null' => TRUE, 'default' => '', ), 'l10n_server' => array( 'description' => 'Localization server for this project.', 'type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => '', ), 'l10n_path' => array( 'description' => 'Server path this project updates.', 'type' => 'varchar', 'length' => '255', 'not null' => TRUE, 'default' => '', ), 'status' => array( 'description' => 'Status flag. TBD', 'type' => 'int', 'not null' => TRUE, 'default' => 1, ), ), 'primary key' => array('name'), ); $schema['myblog_file'] = array( 'description' => 'File and download information for project translations.', 'fields' => array( 'project' => array( 'description' => 'A unique short name to identify the project.', 'type' => 'varchar', 'length' => '50', 'not null' => TRUE, ), 'language' => array( 'description' => 'Reference to the {languages}.language for this translation.', 'type' => 'varchar', 'length' => '12', 'not null' => TRUE, ), 'type' => array( 'description' => 'File origin: download or localfile', 'type' => 'varchar', 'length' => '50', 'not null' => TRUE, 'default' => '', ), 'filename' => array( 'description' => 'Link to translation file for download.', 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', ), 'fileurl' => array( 'description' => 'Link to translation file for download.', 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', ), 'uri' => array( 'description' => 'File system path for importing the file.', 'type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', ), 'timestamp' => array( 'description' => 'Unix timestamp of the time the file was downloaded or saved to disk. Zero if not yet downloaded', 'type' => 'int', 'not null' => FALSE, 'disp-width' => '11', 'default' => 0, ), 'version' => array( 'description' => 'Version tag of the downloaded file.', 'type' => 'varchar', 'length' => '128', 'not null' => TRUE, 'default' => '', ), 'status' => array( 'description' => 'Status flag. TBD', 'type' => 'int', 'not null' => TRUE, 'default' => 1, ), 'last_checked' => array( 'description' => 'Unix timestamp of the last time this translation was downloaded from or checked at remote server and confirmed to be the most recent release available.', 'type' => 'int', 'not null' => FALSE, 'disp-width' => '11', 'default' => 0, ), ), 'primary key' => array('project', 'language'), ); $schema['cache_myblog'] = drupal_get_schema_unprocessed('system', 'cache'); $schema['cache_myblog']['description'] = 'Cache table for the Localization Update module to store information about available releases, fetched from central server.'; return $schema; } ?>
相关文章推荐
- SQL Server 2000数据库的创建,删除,备份,还原
- EF Code First学习笔记:数据库创建(转载修改)
- windows下数据库的创建方法汇总
- STS创建Spring Boot项目实战(Rest接口、数据库、用户认证、分布式Token JWT、Redis操作、日志和统一异常处理)
- mysql在创建数据库时指定编码
- catalog数据库的创建
- Lucene学习之一:使用lucene为数据库表创建索引,并按关键字查询
- Oracle数据库如何创建DATABASE LINK
- 创建数据库
- Android基础-初识SQLite第2章SQLite数据库的操作 2-1数据库的创建
- Android:创建打开数据库失败
- MySQL创建带有编码的数据库
- MYSQL添加新用户 MYSQL为用户创建数据库 MYSQL为新用户分配权限
- mongodb的安装、创建数据库、设置用户(Window 7)
- MYSQL 创建数据库
- 如何创建数据库Web Services
- iOS MAC终端界面 ~ 创建数据库sqlite3
- Hibernate创建表成功,但数据库中却没有表的解决方法
- 创建数据库、表、表约束以及删除约束
- [LINQ TO SQL]使用LINQ TO SQL创建数据库