You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on May 13, 2022. It is now read-only.
Hi there! I'm trying to use schema_plus on a new rails project from scratch. I see references to disabling automatic foreign key creation, but it doesn't seem to be working for me. I'm using schema_plus 1.4.1 with PostgreSQL.
My config/initializers/schema_plus.rb contains:
SchemaPlus.setup do |config|
config.foreign_keys.auto_create = false
end
My migration file is essentially:
create_table :champions do |t|
t.string :api_id, null: false, index: { unique: true }
# ...other columns...
t.timestamps
end
Running bundle exec rake db:migrate results in:
== 20140315224008 CreateChampions: migrating ==================================
-- create_table(:champions)
rake aborted!
An error has occurred, this and all later migrations canceled:
PG::UndefinedTable: ERROR: relation "apis" does not exist
: CREATE TABLE "champions" ("id" serial primary key, "api_id" character varying(255) NOT NULL, "name" character varying(255) NOT NULL, "title" character varying(255) NOT NULL, "image" character varying(255) NOT NULL, "attack_rank" integer NOT NULL, "defense_rank" integer NOT NULL, "magic_rank" integer NOT NULL, "difficulty_rank" integer NOT NULL, "created_at" timestamp, "updated_at" timestamp, CONSTRAINT fk_champions_api_id FOREIGN KEY ("api_id") REFERENCES "apis" ("id"))
Any idea why the FK option is not disabled despite my attempt to explicitly disable?
The text was updated successfully, but these errors were encountered:
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi there! I'm trying to use schema_plus on a new rails project from scratch. I see references to disabling automatic foreign key creation, but it doesn't seem to be working for me. I'm using schema_plus 1.4.1 with PostgreSQL.
My
config/initializers/schema_plus.rb
contains:My migration file is essentially:
Running
bundle exec rake db:migrate
results in:Any idea why the FK option is not disabled despite my attempt to explicitly disable?
The text was updated successfully, but these errors were encountered: