在续集迁移中遇到了一些麻烦,并可能使用另一组眼睛。 我运行的迁移看起来不错,但没有创建表。这是肯定连接,因为我可以看到schema_info表已被创建。 -M 0/1会根据您的预期更改版本,但仍然没有表格。续集迁移无法运行?
的命令:
sequel -m . -M 1 ~/Desktop/dbtest/testdb.yml
001_testdb.rb:
class TestDb < Sequel::Migration
def up
create_table("terminals") do
primary_key :id
Integer :location_id
Integer :merchant_id
BigDecimal :terminal_id, :size=>[11, 0]
String :reference, :size=>255
DateTime :created_at
DateTime :updated_at
String :image, :default=>"default.jpg", :size=>255
end
end
def down
drop_table :terminals
end
end
在Postgres的输出:
test_db=# \dt
List of relations
Schema | Name | Type | Owner
--------+-------------+-------+----------
public | schema_info | table | postgres
(1 row)
test_db=# select * from schema_info;
version
---------
1
(1 row)
好像你应该使用downcased标识符? – mikezter 2010-04-14 12:30:55
你在那里看到的def是使用续集自己的表转储创建的。所以语法应该没问题。它也同意这个主题上似乎只存在的两个教程...谢谢,但我不认为就是这样。我认为这可能与命名有关,但我不知道是什么。无法找到任何文档。哎呀。 – mikewilliamson 2010-04-15 04:34:21