gpt4 book ai didi

Symfony2 + Capifony Doctrine 迁移

转载 作者:行者123 更新时间:2023-12-01 08:08:12 26 4
gpt4 key购买 nike

我已经将 DoctrineMigrationsBundle 安装到我的 Symfony2 应用程序,但是当我尝试部署到我的开发服务器时,我收到以下错误:

    Do you really want to migrate dev's database? (y/N)
y
* executing "sh -c ' cd /var/www/vhosts/xyz.co.uk/releases/20130413181722 && php app/console doctrine:migrations:migrate --env=dev --no-interaction'"
servers: ["x.xx.xx.xxx"]
[x.xx.xx.xxx] executing command
** [out :: x.xx.xx.xxx]
** [out :: x.xx.xx.xxx] Application Migrations
** [out :: x.xx.xx.xxx]
** [out :: x.xx.xx.xxx]
** [out :: x.xx.xx.xxx] Migrating up to 0 from 0
** [out :: x.xx.xx.xxx]
** [out :: x.xx.xx.xxx]
** [out :: x.xx.xx.xxx]
** [out :: x.xx.xx.xxx] [Doctrine\DBAL\Migrations\MigrationException]
** [out :: x.xx.xx.xxx] Could not find any migrations to execute.
** [out :: x.xx.xx.xxx]
** [out :: x.xx.xx.xxx]
** [out :: x.xx.xx.xxx]
** [out :: x.xx.xx.xxx] doctrine:migrations:migrate [--write-sql] [--dry-run] [--configuration[="..."]] [--db-configuration[="..."]] [--em[="..."]] [version]
** [out :: x.xx.xx.xxx]
** [out :: x.xx.xx.xxx]
command finished in 802ms
*** [symfony:doctrine:migrations:migrate] rolling back
Do you really want to migrate dev's database back to version 0? (y/N)

知道是什么原因造成的吗?

这是我的 deploy.rb 文件:
set :stage_dir, 'app/config/deploy'
set :stages, %w(production staging development)
require 'capistrano/ext/multistage'

set :application, "xyz.co.uk"
set :user, "deployer" # The server's user for deploys

set :normalize_asset_timestamps, false

set :repository, "git@github.xyz/xyz.co.uk.git"
set :scm, :git
set :keep_releases, 3
after "deploy:update", "deploy:cleanup"
set :use_sudo, false
set :web_path, "web"
set :shared_files, ["app/config/parameters.yml"]
set :shared_children, [app_path + "/logs", web_path + "/uploads"]
set :use_composer, true
set :update_vendors, true
set :dump_assetic_assets, true
set :deploy_via, :remote_cache

#logger.level = Logger::MAX_LEVEL

before "symfony:cache:warmup", "symfony:doctrine:migrations:migrate"

after "deploy:update_code" do
capifony_pretty_print "--> Ensuring cache directory permissions"
run "setfacl -R -m u:www-data:rwX -m u:`whoami`:rwX #{latest_release}/#{cache_path}"
run "setfacl -dR -m u:www-data:rwX -m u:`whoami`:rwX #{latest_release}/#{cache_path}"
capifony_puts_ok
end

更新

问题是因为我没有提交 Doctrine 迁移版本文件并将它们推送到 GitHub。对实体进行更改后,这是正确的过程吗:
php app/console doctrine:migrations:diff 
php app/console doctrine:schema:update --force
git add app/DoctrineMigrations/Version1234.php
git commit -a -m "migration"
git push origin develop
cap development deploy

最佳答案

不是php app/console doctrine:schema:update --force但是 php app/console doctrine:migration:migrate .

您可以使用 cap development deploy:migrations以便在部署后执行迁移。

希望它有帮助。
最良好的问候。

关于Symfony2 + Capifony Doctrine 迁移,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15987310/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com