我是新來的Yii(仍在學習)我下面一本書的教程 我在這裏做了,因爲它是寫在書中創造了一個新的遷移Yii的遷移,表不創建
yiic migrate create create_issue_user_and_assignment_tables
和safeup我寫此查詢
$this->createTable('tbl_issue', array(
'id' => 'pk',
'name' => 'string NOT NULL',
'description' => 'text',
'project_id' => 'int(11) DEFAULT NULL',
'type_id' => 'int(11) DEFAULT NULL',
'status_id' => 'int(11) DEFAULT NULL',
'owner_id' => 'int(11) DEFAULT NULL',
'requester_id' => 'int(11) DEFAULT NULL',
'create_time' => 'datetime DEFAULT NULL',
'create_user_id' => 'int(11) DEFAULT NULL',
'update_time' => 'datetime DEFAULT NULL',
'update_user_id' => 'int(11) DEFAULT NULL',
), 'ENGINE=InnoDB');
//create the user table
$this->createTable('tbl_user', array(
'id' => 'pk',
'username' => 'string NOT NULL',
'email' => 'string NOT NULL',
'password' => 'string NOT NULL',
'last_login_time' => 'datetime DEFAULT NULL',
'create_time' => 'datetime DEFAULT NULL',
'create_user_id' => 'int(11) DEFAULT NULL',
'update_time' => 'datetime DEFAULT NULL',
'update_user_id' => 'int(11) DEFAULT NULL',
), 'ENGINE=InnoDB');
而這safeDown()
$this->dropTable('tbl_issue');
$this->dropTable('tbl_user');
然後運行它,並得到了如下荷蘭國際集團味精
D:\wamp\www\yiisite\protected>yiic migrate
PHP Deprecated: Directive 'register_globals' is deprecated in PHP 5.3 and great
er in Unknown on line 0
Deprecated: Directive 'register_globals' is deprecated in PHP 5.3 and greater in
Unknown on line 0
Yii Migration Tool v1.0 (based on Yii v1.1.13)
Total 1 new migration to be applied:
m130703_085302_create_issue_user_and_assignment_tables
Apply the above migration? (yes|no) [no]:yes
*** applying m130703_085302_create_issue_user_and_assignment_tables
*** applied m130703_085302_create_issue_user_and_assignment_tables (time: 0.042s
)
Migrated up successfully.
現在的問題是,表不是在數據庫中可能是因爲味精中創造了register_globals的已被棄用,但我不知道該怎麼辦,連接參數是否正確,並插入一條記錄在表中tbl_migration
m130703_085302_create_issue_user_and_assignment_ta... 1372842220
但是沒有創建新表。