gpt4 book ai didi

ruby-on-rails - PG::UndefinedTable:错误:关系 "users"不存在 - Azure 数据库

转载 作者:行者123 更新时间:2023-12-03 04:13:07 24 4
gpt4 key购买 nike

在 Azure 上部署 Web 应用程序(通过 Linux 虚拟机)后,我成功访问主页(首页),但在尝试登录(导航栏右上角)时收到此错误:

Error

我查了一下这个问题,发现其他人也有这个问题。他们通过重置和迁移解决了这个问题,但不起作用。到目前为止我已经尝试过:

  1. 以下命令可以正确执行,但不能解决问题:

    RAILS_ENV=生产 rake db:drop db:create db:migrate

  2. 注释掉user.rb文件但并没有解决问题

我认为该错误是由于 gem devise 或 gem rails_admin 引起的,但我无法找到解决方案。

gem 文件:

source 'https://rubygems.org'

ruby '2.6.0'

gem 'grape'

gem 'bootsnap', require: false

gem 'devise'

gem 'jbuilder', '~> 2.0'

gem 'pg', '~> 0.21'

gem 'puma'

gem 'rails', '5.2.2'

gem 'redis'

gem "mini_magick"

gem "chartkick"

gem 'country-select'

gem 'rails_admin', '~> 1.3'

gem 'activestorage-validator'

gem 'rubyzip', '>= 1.2.1'

gem 'axlsx', git: 'https://github.com/randym/axlsx.git', ref: 'c8ac844'

gem 'axlsx_rails'

gem 'autoprefixer-rails'

gem 'bootstrap-sass', '~> 3.3'

gem 'font-awesome-sass', '~> 5.5.0'

gem 'sassc-rails'

gem 'simple_form'

gem 'uglifier'

gem 'webpacker'

group :development do

gem 'web-console', '>= 3.3.0'

end

group :development, :test do

gem 'pry-byebug'

gem 'pry-rails'

gem 'listen', '~> 3.0.5'

gem 'spring'

gem 'spring-watcher-listen', '~> 2.0.0'

gem 'dotenv-rails'

end

database.yml的内容:

default: &default
adapter: postgresql
encoding: utf-8
database: caoee
username: mat
password: ***
pool: 5
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>

development:
<<: *default
adapter: postgresql
encoding: utf-8
database: caoee
username: mat
password: ***
pool: 5

test:
<<: *default
adapter: postgresql
encoding: utf-8
database: caoee
username: mat
password: ***
pool: 5

production:
adapter: postgresql
encoding: utf-8
database: caoee
username: mat
password: ***
pool: 5

Postgresql 角色:

角色列表

Role name | Attributes | Member of
-----------------------------------
mat | Superuser, Create role, Create DB | {}

postgres | Superuser, Create role, Create DB, Replication, Bypass RLS|{}

最佳答案

您是否在本地运行该命令RAILS_ENV=product ...?因为这只会使用生产设置在本地运行命令。

您需要重置 Azure 服务器上的数据库。我不熟悉 Azure CLI,但我确信有命令可以远程重置数据库。

关于ruby-on-rails - PG::UndefinedTable:错误:关系 "users"不存在 - Azure 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55464434/

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