マイグレーションファイルを作成し、oil r migrateにて実行しましたが、以下のエラーで進まないです。
shell
1Uncaught exception Fuel\Core\Database_Exception: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NOT NULL, 2 `modified_datetime` datetime NOT NULL, 3 PRIMARY KEY `id``id` (`id`) 4)' at line 10 with query: "CREATE TABLE IF NOT EXISTS `users` ( 5 `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, 6 `name` varchar(50) NOT NULL, 7 `email` varchar(100) NOT NULL, 8 `entry_token` text NOT NULL, 9 `remember_token` text NOT NULL, 10 `inactive` tinyint(100) UNSIGNED NOT NULL, 11 `create_person` varchar(20) NOT NULL, 12 `created_datetime` datetime NOT NULL, 13 `modified` varchar NOT NULL, 14 `modified_datetime` datetime NOT NULL, 15 PRIMARY KEY `id``id` (`id`)
PRIMARY KEY id``id
(id
)が何かおかしな感じがしますが、コード上では問題がないように見えます。
ご教授願います。
php
1<?php 2namespace Fuel\Migrations; 3 4class Create_users_table 5{ 6 public function up() 7 { 8 \DBUtil::create_table('users', array( 9 'id' => array('constraint' => 11, 'type' => 'int', 'auto_increment' => true, 'unsigned' => true), 10 'name' => array('constraint' => 50, 'type' => 'varchar'), 11 'email' => array('constraint' => 100, 'type' => 'varchar'), 12 'entry_token' => array('type' => 'text'), 13 'remember_token' => array('type' => 'text'), 14 'inactive' => array('constraint' => 100, 'type' => 'tinyint', 'unsigned' => true), 15 'create_person' => array('constraint' => 20, 'type' => 'varchar'), 16 'created_datetime' => array('type' => 'datetime'), 17 'modified' => array('type' => 'varchar'), 18 'modified_datetime' => array('type' => 'datetime'), 19 ), array('id')); 20 } 21 22 public function down() 23 { 24 \DBUtil::drop_table('users'); 25 } 26} 27
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。