gpt4 book ai didi

ruby-on-rails - 迁移错误

转载 作者:行者123 更新时间:2023-11-29 13:15:32 25 4
gpt4 key购买 nike

我尝试运行数据库迁移,但出现以下错误

PG::UndefinedTable: ERROR:  relation "authie_sessions" does not exist

: ALTER TABLE "authie_sessions" ADD "two_factored_at" timestamp/home/levi/.rvm/gems/ruby-2.4.1/gems/activerecord-5.1.5/lib/active_record/connection_adapters/postgresql/database_statements.rb:73:in `async_exec'

我的迁移文件是

class AddTwoFactorAuthFieldsToAuthie < ActiveRecord::Migration[4.2]
def change
add_column :authie_sessions, :two_factored_at, :datetime
add_column :authie_sessions, :two_factored_ip, :string
add_column :authie_sessions, :requests, :integer, :default => 0
add_column :authie_sessions, :password_seen_at, :datetime
end
end

我的database.yml是

default: &default
adapter: postgresql
encoding: utf8
pool: 5
username: postgres
password: postgres
database: staytus
host: 127.0.0.1

production:
<<: *default

development:
<<: *default

test:
<<: *default
database: staytus_test

我正在使用 postgresql

最佳答案

检查 authie_sessions 表存在于数据库 staytusstaytus_test 中。

关于ruby-on-rails - 迁移错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49655565/

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