开发者

Symfony propel:insert-sql with specified user?

开发者 https://www.devze.com 2023-01-07 01:21 出处:网络
I am running Symfony 1.3.6 on Ubuntu Lucid. My db connections for Symfony are made with a user with reduced priveleges (no need for CREATE or DROP for example) - for security reasons.

I am running Symfony 1.3.6 on Ubuntu Lucid.

My db connections for Symfony are made with a user with reduced priveleges (no need for CREATE or DROP for example) - for security reasons.

I want to be able to run the propel task propel:sql-insert as root, so that I can create/drop tables at will. The brain dead way to do this would be to modify config/database.yml and开发者_JS百科 use a root name and pwd whenever I need to run this task.

A smarter way would be if I could pass a user to the import-sql task. Anyone knows how to do this?


I don't have 1.3 here; rather 1.4, but taking a look inside lib/vendor/symfony/lib/plugins/sfPropelPlugin/lib/task/sfPropelInsertSqlTask.class.php (phew!) yields the following parameter you can pass - presumably the same for 1.3:

You can also use the --connection option if you want to only load SQL statements for a given connection.

Therefore this would imply that you can create a new connection in your config/databases.yml which is specific to the insert-sql task (eg username root, no password), and then pass this connection name along when you run the insert-sql task.

Untested... :-)

0

精彩评论

暂无评论...
验证码 换一张
取 消