Reputation: 24886
I installed postgresql and created a database. When I run rake db:migrate though I am encountering the error below:
[newuser@Freenaut flights1percent{master}]$ rake db:migrate --trace
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== CreatePeople: migrating ===================================================
-- create_table(:people)
NOTICE: CREATE TABLE will create implicit sequence "people_id_seq" for serial column "people.id"
rake aborted!
An error has occurred, this and all later migrations canceled:
PGError: ERROR: relation "people" already exists
: CREATE TABLE "people" ("id" serial primary key, "created_at" timestamp, "updated_at" timestamp)
This is a strange error because the error message says this table already exists. However, I know that it shouldn't as I just created the database. So what's going down wrong here?
Upvotes: 0
Views: 296
Reputation: 1372
This shouldn't happen unless the table does indeed exist. Could it be that you created the table as part of testing before running the migration?
I ran your create table on an 8.4 db and this is what I got:
CREATE TABLE "people" ("id" serial primary key, "created_at" timestamp, "updated_at" timestamp);
NOTICE: CREATE TABLE will create implicit sequence "people_id_seq" for serial column "people.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "people_pkey" for table "people"
CREATE TABLE
And then I ran it again after and recieved the same error message that you did:
CREATE TABLE "people" ("id" serial primary key, "created_at" timestamp, "updated_at" timestamp);
NOTICE: CREATE TABLE will create implicit sequence "people_id_seq1" for serial column "people.id"
ERROR: relation "people" already exists
Upvotes: 1