我刚刚从sqlite3更改为PG,在通过pgAdmin创建数据库并尝试运行迁移后,我遇到了以下情况,我不明白。
Pawel:bodb pawel$ rake db:create
DEPRECATION WARNING: Rake tasks in /Users/pawel/Ruby/apps/bodb/vendor/plugins/google_charts_on_rails/tasks/google_charts_on_rails_tasks.rake are deprecated. Use lib/tasks instead. (called from /Users/pawel/Ruby/apps/bodb/Rakefile:7)
firstdb already exists
Pawel:bodb pawel$ rake db:migrate
DEPRECATION WARNING: Rake tasks in /Users/pawel/Ruby/apps/bodb/vendor/plugins/google_charts_on_rails/tasks/google_charts_on_rails_tasks.rake are deprecated. Use lib/tasks instead. (called from /Users/pawel/Ruby/apps/bodb/Rakefile:7)
== AddLikesToUsers: migrating ================================================
-- add_column(:Users, :likes, :string)
rake aborted!
An error has occurred, this and all later migrations canceled:
PGError: ERROR: relation "Users" does not exist
: ALTER TABLE "Users" ADD COLUMN "likes" character varying(255)
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
答案 0 :(得分:3)
答案 1 :(得分:1)
似乎迁移假设已经存在Users表,而不是全新的PostgreSQL数据库...
您是否忘记将一些启动架构添加到数据库中?