BadrIT / translation_center

Translation Center is a multi-lingual, GUI rich, community based, translation center for Rails apps
http://www.badrit.com/gems/translation_center/
MIT License
152 stars 71 forks source link

PG::Error: ERROR: relation "auditables" does not exist #36

Open ronaldocpontes opened 11 years ago

ronaldocpontes commented 11 years ago

Can't install translation_center...

Steps:

$ rails generate translation_center:install en pt
$ rake db:migrate

==  InstallAudited: migrating =================================================
-- create_table(:audits, {:force=>true})
NOTICE:  table "audits" does not exist, skipping
NOTICE:  CREATE TABLE will create implicit sequence "audits_id_seq" for serial column "audits.id"
NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index "audits_pkey" for table "audits"
rake aborted!
An error has occurred, this and all later migrations canceled:

PG::Error: ERROR:  relation "auditables" does not exist
: CREATE TABLE "audits" ("id" serial primary key, "auditable_id" integer, "auditable_type" character varying(255), "associated_id" integer, "associated_type" character varying(255), "user_id" integer, "user_type" character varying(255), "username" character varying(255), "action" character varying(255), "audited_changes" text, "version" integer DEFAULT 0, "comment" character varying(255), "remote_address" character varying(255), "created_at" timestamp, CONSTRAINT fk_audits_auditable_id FOREIGN KEY ("auditable_id") REFERENCES "auditables" ("id"), CONSTRAINT fk_audits_associated_id FOREIGN KEY ("associated_id") REFERENCES "associateds" ("id"), CONSTRAINT fk_audits_user_id FOREIGN KEY ("user_id") REFERENCES "users" ("id")) /home/ronaldocpontes/.rvm/gems/ruby-1.9.3-p448/gems/rack-mini-profiler-0.1.26/Ruby/lib/patches/sql_patches.rb:155:in `exec'
kabdelhady commented 11 years ago

I couldn't reproduce this bug on Rails 3.2.13, pg 0.16.0, translation_center 1.6.7 and Ubuntu 12 Please let me know you versions, also do you already have audits (audited gem) https://github.com/collectiveidea/audited in your project ?

ronaldocpontes commented 11 years ago

I didn't had audits before.... the gems audited (3.0.0) and audited-activerecord (3.0.0) where installed by translation_center.

I am trying to install translation_center on top of of a fresh clone of https://github.com/catarse/catarse on Postgres

Just clone the project, change database.yml, install translation_center and run db:create + db:migrate.

If you prefer I can send you all my migrations.

Thanks,

ronaldocpontes commented 11 years ago

Here is a forked branch with my current files:

https://github.com/ronaldocpontes/catarse/tree/translation

paulj commented 10 years ago

I got this problem too when installing into my application - it is an issue caused by the schema_plus gem. If you work through each of the generated migrations and add foreign_key: false to each field that ends in _id, then the migrations will work.

VEkh commented 9 years ago

Thanks @paulj! I was facing the same issue with polymorphic references in my migrations. Your suggestion to explicitly set :foreign_key=>false for the problem fields worked for me too. I guess it's still a schema_plus gem error as of 1.8.6 :pensive:.