Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/61.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 部署进程上的迁移被中止,错误为:PG::UndefinedTable:error:relation";播放列表“;不存在_Ruby On Rails_Deployment_Rails Migrations_Capistrano3 - Fatal编程技术网

Ruby on rails 部署进程上的迁移被中止,错误为:PG::UndefinedTable:error:relation";播放列表“;不存在

Ruby on rails 部署进程上的迁移被中止,错误为:PG::UndefinedTable:error:relation";播放列表“;不存在,ruby-on-rails,deployment,rails-migrations,capistrano3,Ruby On Rails,Deployment,Rails Migrations,Capistrano3,这是我的一次迁移: class AddTranslationsForPlaylistsYoutubesDjSetsAndPodcasts < ActiveRecord::Migration[6.0] def change reversible do |dir| dir.up do Djset.create_translation_table!({ title: :string }, { migrate_data: true, remove_sourc

这是我的一次迁移:

class AddTranslationsForPlaylistsYoutubesDjSetsAndPodcasts < ActiveRecord::Migration[6.0]
  def change
    reversible do |dir|
      dir.up do
        Djset.create_translation_table!({ title: :string }, { migrate_data: true, remove_source_columns: true })
        Playlist.create_translation_table!({ title: :string }, { migrate_data: true, remove_source_columns: true })
        YouTube.create_translation_table!({ title: :string }, { migrate_data: true, remove_source_columns: true })
        Podcast.create_translation_table!({ title: :string }, { migrate_data: true, remove_source_columns: true })
      end

      dir.down do
        Djset.drop_translation_table! migrate_data: true
        Playlist.drop_translation_table! migrate_data: true
        YouTube.drop_translation_table! migrate_data: true
        Podcast.drop_translation_table! migrate_data: true
      end
    end
  end
end

你能发布完整的错误报告吗?这一行之后是否还有其他内容
PG::UndefinedTable:错误:关系“playlists”不存在
?@nuaky,从capistrano.logIt添加的日志看起来与制作播放列表表之前创建的
播放列表
相关。在不知道这些表的情况下,只能猜测是哪一个,但我的猜测是
djset
。您是否验证了“playlists”表确实存在?
DEBUG [9cd2ebc3]    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/postgresql/database_statements.rb:65:in `async_exec'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/postgresql/database_statements.rb:65:in `block (2 levels) in query'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies/interlock.rb:48:in `block in permit_concurrent_loads'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/concurrency/share_lock.rb:187:in `yield_shares'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/dependencies/interlock.rb:47:in `permit_concurrent_loads'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/postgresql/database_statements.rb:64:in `block in query'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract_adapter.rb:685:in `block (2 levels) in log'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract_adapter.rb:684:in `block in log'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activesupport-6.0.0.rc1/lib/active_support/notifications/instrumenter.rb:24:in `instrument'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract_adapter.rb:675:in `log'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/postgresql/database_statements.rb:63:in `query'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/postgresql_adapter.rb:806:in `column_definitions'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract/schema_statements.rb:114:in `columns'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/schema_cache.rb:76:in `columns'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/schema_cache.rb:82:in `columns_hash'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/model_schema.rb:487:in `load_schema!'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/attributes.rb:247:in `load_schema!'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/attribute_decorators.rb:51:in `load_schema!'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/model_schema.rb:480:in `block in load_schema'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/model_schema.rb:477:in `load_schema'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/model_schema.rb:357:in `columns'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/bundler/gems/globalize-8af95a12a0dc/lib/globalize/active_record/migration.rb:18:in `columns'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/bundler/gems/globalize-8af95a12a0dc/lib/globalize/active_record/migration.rb:172:in `column_type'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/bundler/gems/globalize-8af95a12a0dc/lib/globalize/active_record/migration.rb:85:in `block in create_translation_table'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract/schema_statements.rb:309:in `create_table'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/bundler/gems/globalize-8af95a12a0dc/lib/globalize/active_record/migration.rb:81:in `create_translation_table'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/bundler/gems/globalize-8af95a12a0dc/lib/globalize/active_record/migration.rb:39:in `create_translation_table!'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/bundler/gems/globalize-8af95a12a0dc/lib/globalize/active_record/migration.rb:10:in `create_translation_table!'
    /home/deployer/apps/my-app/releases/20200228105525/db/migrate/20200220101151_add_translations_for_playlists_youtubes_dj_sets_and_podcasts.rb:5:in `block (2 levels) in change'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:705:in `up'
    /home/deployer/apps/my-app/releases/20200228105525/db/migrate/20200220101151_add_translations_for_playlists_youtubes_dj_sets_and_podcasts.rb:4:in `block in change'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:741:in `block in reversible'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:967:in `execute_block'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:741:in `reversible'
    /home/deployer/apps/my-app/releases/20200228105525/db/migrate/20200220101151_add_translations_for_playlists_youtubes_dj_sets_and_podcasts.rb:3:in `change'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:820:in `exec_migration'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:804:in `block (2 levels) in migrate'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:803:in `block in migrate'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract/connection_pool.rb:416:in `with_connection'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:802:in `migrate'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:992:in `migrate'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1300:in `block in execute_migration_in_transaction'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1351:in `block in ddl_transaction'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract/database_statements.rb:277:in `block in transaction'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract/transaction.rb:272:in `block in within_new_transaction'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract/transaction.rb:270:in `within_new_transaction'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/connection_adapters/abstract/database_statements.rb:277:in `transaction'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/transactions.rb:212:in `transaction'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1351:in `ddl_transaction'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1299:in `execute_migration_in_transaction'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1271:in `block in migrate_without_lock'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1270:in `each'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1270:in `migrate_without_lock'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1218:in `block in migrate'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1371:in `with_advisory_lock'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1218:in `migrate'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1051:in `up'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/migration.rb:1026:in `migrate'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/tasks/database_tasks.rb:226:in `migrate'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/railties/databases.rake:83:in `block (3 levels) in <main>'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/railties/databases.rake:81:in `each'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/activerecord-6.0.0.rc1/lib/active_record/railties/databases.rake:81:in `block (2 levels) in <main>'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/gems/rake-12.3.2/exe/rake:27:in `<top (required)>'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/bin/ruby_executable_hooks:24:in `eval'
    /home/deployer/apps/my-app/shared/bundle/ruby/2.6.0/bin/ruby_executable_hooks:24:in `<main>'
     DEBUG [9cd2ebc3]   
    Caused by:
     DEBUG [9cd2ebc3]   PG::UndefinedTable: ERROR:  relation "playlists" does not exist
    LINE 8:  WHERE a.attrelid = '"playlists"'::regclass