Heroku登台应用程序是否与评论应用程序共享数据库?

编程入门 行业动态 更新时间:2024-10-28 06:34:00
本文介绍了Heroku登台应用程序是否与评论应用程序共享数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

使用评论应用程序时,我注意到一些奇怪的行为.我为正在处理的请求请求创建了一个评论应用程序.它的父母是我的分期应用程序.作为拉取请求的一部分,我多次迁移了数据库,并正在使用Review App测试这些迁移.我正在与Rails合作.

I've noticed some odd behaviour when working with review apps. I created a review app for a pull request I was working on. It's parent was my staging app. As part of the pull request I migrated the database many times and I was testing those migrations with the review app. I'm working with Rails.

我正在准备合并所做的更改并部署到登台应用程序,但是我注意到登台应用程序中的数据已更改.自从我开始这项工作以来,还没有部署到舞台上.

I was preparing to merge my changes and deploy to the staging app, but I noticed that the data in my staging app had changed. There have been no deploys to staging since I started this work.

例如,在分阶段中,我有一个QrCode模型,而该模型有一个user_id.使用我的评论应用程序,我迁移了数据库以删除user_id列,并创建了一个具有user_id的新产品模型.现在,在我的登台应用程序中,已从QrCode删除了user_id列,但新的Product模型不存在.好像数据库中的现有表已更新为新架构,而无需添加新表.

For example, in staging I have a QrCode model, and that model has a user_id. With my review app, I migrated the database to drop the user_id column and create a new Product model that has a user_id instead. Now in my staging app, the user_id column has been dropped from QrCode but the new Product model isn't there. It's as if the existing tables in the database have been updated to the new schema, without the new ones being added.

其他人是否遇到过类似的问题,或者知道会发生什么情况?我需要知道所有迁移在部署到生产之前都可以正常工作.

Has anyone else experienced a similar issue, or know what might be going on? I need to know that all migrations work correctly before deploying to production.

推荐答案

好,我知道了这个问题.我已经更新了app.json,将DATABASE_URL列为必需的配置变量.这导致我的评论应用程序具有与我的登台应用程序相同的数据库URL.将其从app.json中删除后,每次构建审阅应用程序时,都会自动生成数据库url配置变量.

Ok I figured out the issue. I had updated my app.json to list DATABASE_URL as a required config variable. That caused my review app to have the same database url as my staging app. Once I removed this from my app.json, the database url config variable is generated automatically each time the review app is built.

更多推荐

Heroku登台应用程序是否与评论应用程序共享数据库?

本文发布于:2023-10-17 12:45:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1500936.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:应用程序   数据库   Heroku

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!