MySQLで「モーター」DBを作成した後、次のコマンドを使用してSymfonyでDBを構成しました。
$ php symfony configure:database "mysql:host=localhost;dbname=motor" root <mypassword>
下appname/config/doctrine/
にschema.yml
ファイルがあります。
このファイルでは、次のテーブルを定義しました。
Car:
actAs: { Timestampable: ~ }
columns:
brand: { type: string(255), notnull: true }
model: { type: string(255), notnull: true }
version: { type: string(255), notnull: true }
url: { type: string(255), notnull: true }
year: { type: string(4), notnull: true }
info: { type: string(10000), notnull: true }
updated_at: { type: timestamp, notnull: true }
created_at: { type: timestamp, notnull: true }
次に、次のコマンドを実行しました。
$ php symfony doctrine:build --model
これにより、次の出力が得られました。
>> doctrine generating model classes
>> file+ /tmp/doctrine_schema_57936.yml
>> tokens /home/username/webapps/www/appname/lib/model/doctrine/CarTable.class.php
>> tokens /home/username/webapps/www/appname/lib/model/doctrine/Car.class.php
>> tokens /home/username/webapps/www/appname/lib/model/doctrine/base/BaseCar.class.php
>> autoload Resetting application autoloaders
>> file- /home/username/webapps/www/appname/cache/frontend/dev/config/config_autoload.yml.php
その後、次のコマンドを使用してSQLの生成に進みました。
$ php symfony doctrine:build --sql
出力は次のとおりです。
>> doctrine generating model classes
>> file+ /tmp/doctrine_schema_89541.yml
>> tokens /home/username/webapps/www/motor/lib/model/doctrine/base/BaseCar.class.php
>> autoload Resetting application autoloaders
>> file- /home/username/webapps/www/motor/cache/frontend/dev/config/config_autoload.yml.php
>> doctrine generating sql for models
>> doctrine Generated SQL successfully for models
ただし、生成されappname/data/sql/
たファイルの下schema.sql
は空です。
したがって、このコマンド$ php symfony doctrine:insert-sql
は、私のDBにテーブルを生成しませんでした。ただし、メッセージ出力は成功しました。
>> doctrine creating tables
>> doctrine created tables successfully
コマンド$ php symfony doctrine:build --all
も機能しませんでした。
私が間違っている可能性があることは何か考えていますか?