【问题标题】:How to use `gcloud builds` for database migrations如何使用 `gcloud builds` 进行数据库迁移
【发布时间】:2018-12-07 20:54:05
【问题描述】:

我按照他们的tutorial 使用 Cloud SQL for MySQL 使用 Google App Engine 部署了一个 Rails 5 应用程序。

当我运行数据库迁移时,

bundle exec rake appengine:exec -- bundle exec rake db:migrate

我收到弃用警告:

WARNING: This command is deprecated and will be removed on or after 2018-10-31. Please use `gcloud builds submit` instead.

在我着手解决这个问题之前,有没有其他人将他们的 Rails 应用程序转换为使用 gcloud builds 来执行这样的 rake 任务?介意分享要点吗?谢谢!

【问题讨论】:

    标签: google-app-engine google-cloud-platform ruby-on-rails-5


    【解决方案1】:

    转到 Google Cloud Platform Console 中的 Cloud SQL 实例页面。 ... 选择要将数据库添加到的实例。 选择数据库选项卡。 单击创建数据库。 在 Create a database 对话框中,指定数据库的名称,以及可选的字符集和排序规则。 ... 点击创建。

    如果这不是您想要的,请尝试重新开始

    【讨论】:

      【解决方案2】:

      我最终找到了this answer,它通过安装云 sql 代理,因此您可以在本地运行迁移:

      RAILS_ENV=production bin/rails db:migrate
      

      我仍然对在云中轻松执行命令的新方法感兴趣,但现在使用 db 代理在本地运行完全可行。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2017-02-10
        • 2019-12-02
        • 2021-10-25
        • 1970-01-01
        • 2020-04-21
        相关资源
        最近更新 更多