Ramaze 的续集迁移?

发布于 2024-07-26 03:04:04 字数 601 浏览 3 评论 0原文

我正在尝试在 Ramaze 中设置迁移。 我主要从事 Rails 的工作,但我想尝试一些其他的东西。 不管怎样,我的项目中有一个名为“migrations”的目录,其中有一个 start.rb 文件,然后是我的迁移。 这里是 start.rb:

require File.expand_path('../app.rb', File.dirname(__FILE__))
require 'sequel/extensions/migration.rb'

Sequel::Migrator.apply(DB, '.')

现在,首先,我不知道为什么我不能直接做

Sequel::Model.plugin(:migration)

而不是那么长的 require,但它似乎有效,所以我不太担心它。 主要问题是我的迁移没有实际运行。 它创建了 schema_info 表,所以我知道它正在尝试工作,但它只是找不到位于同一目录中的 000_initial_info.rb 文件。

我实在找不到这方面的任何文档,所以这是我自己的解决方案。 如果我的做法完全错误,我也很想听到其他解决方案。 谢谢你的帮助!

I'm trying to get migrations set up in Ramaze. I'm coming from doing mostly Rails stuff, but I wanted to give something else a shot. Anyway, I've got a directory in my project called "migrations" with a start.rb file and then my migrations. Here's start.rb:

require File.expand_path('../app.rb', File.dirname(__FILE__))
require 'sequel/extensions/migration.rb'

Sequel::Migrator.apply(DB, '.')

Now, first of all, I don't know why I can't just do

Sequel::Model.plugin(:migration)

instead of that long require, but it seems to be working, so I'm not worrying about it too much. The main problem is that none of my migrations actually run. It creates the schema_info table, so I know it's trying to work, but it just can't find my 000_initial_info.rb file that's right there in the same directory.

I couldn't really find any documentation on this, so this is my own solution. I'd love to hear other solutions as well if I'm just going about this all wrong. Thanks for any help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

少女情怀诗 2024-08-02 03:04:04

您不能使用 Sequel::Model.plugin :migration 因为迁移不是模型插件,它是核心扩展。 这将起作用:

Sequel.extension :migration

Sequel 附带了 bin/sequel 工具,您可以使用该工具通过 -m 开关运行迁移:

sequel -m /path/to/app/migrations

除非您有特殊需要,否则我建议使用那。

您的设置问题之一可能是您从 000 开始迁移。从 001 开始迁移可能会效果更好。

有迁移器的 rdoc 文档:

http://sequel.rubyforge.org /rdoc-plugins/classes/Sequel/Migrator.html

You can't use Sequel::Model.plugin :migration because migration is not a model plugin, it is a core extension. This will work:

Sequel.extension :migration

Sequel comes with the bin/sequel tool that you can use to run migrations with the -m switch:

sequel -m /path/to/app/migrations

Unless you have special needs, I recommend using that.

One of the problems with your setup might be that you started your migrations at 000. Start them at 001 and it may work better.

There's rdoc documentation for the Migrator:

http://sequel.rubyforge.org/rdoc-plugins/classes/Sequel/Migrator.html

红尘作伴 2024-08-02 03:04:04

这是我的解决方案:

http://github.com/mwlang/ramaz-sequel-proto-实验

运行“rake -T”来查看我编写的各种数据库和迁移任务。”

我目前使用这个“实验”作为我的 ramaze 项目模板。

Here's my solution:

http://github.com/mwlang/ramaze-sequel-proto-experimental

Run "rake -T" to see the various db and migrate tasks I've written."

I use this "experimental" as my ramaze project template at the moment.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文