我可以cap deploy
成功运行,但是当我尝试运行时cap deploy:migrate
,出现以下错误:
*** [err :: domain.com.br] rake aborted!
*** [err :: domain.com.br] PG::Error: ERROR: Relation"posts"does not exist
*** [err :: domain.com.br] LINE 4: WHERE a.attrelid = '"posts"'::regclass
*** [err :: domain.com.br] ^
*** [err :: domain.com.br] : SELECT a.attname, format_type(a.atttypid, a.atttypmod), d.adsrc, a.attnotnull
*** [err :: domain.com.br] FROM pg_attribute a LEFT JOIN pg_attrdef d
*** [err :: domain.com.br] ON a.attrelid = d.adrelid AND a.attnum = d.adnum
*** [err :: domain.com.br] WHERE a.attrelid = '"posts"'::regclass
*** [err :: domain.com.br] AND a.attnum > 0 AND NOT a.attisdropped
*** [err :: domain.com.br] ORDER BY a.attnum
*** [err :: domain.com.br]
*** [err :: domain.com.br] Tasks: TOP => db:migrate => environment
*** [err :: domain.com.br] (See full trace by running task with --trace)
command finished in 8091ms
我已经在运行的服务器上创建了数据库:
create database <databasename>;
编辑 添加迁移示例:
class AddStatusTagsViewsToPosts < ActiveRecord::Migration
def change
change_table :posts do |p|
p.string :status, default: 'pending'
p.string :tags
p.integer :views
end
end
end
有什么帮助吗?