Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When the app 'rest_framework.authtoken' is included in INSTALLED_APPS we get the error pq: relation "authtoken_token" already exists #24

Open
saran-greytip opened this issue Jun 19, 2024 · 0 comments

Comments

@saran-greytip
Copy link

When 'rest_framework.authtoken' is included get the error pq: relation "authtoken_token" already exists. Below is the full error

Error: read state from "django/schema.sql": executing statement: "CREATE TABLE \"authtoken_token\" ();": pq: relation "authtoken_token" already exists

I tried generating the SQL script using " python manage.py atlas-provider-django --dialect "PostgreSQL" , I see the CREATE TABLE "authtoken_token" is there twice". Refer to the below generated script.

The issue is it is trying to create a script for in-herited model TokenProxy.

-- Create model Token
--
CREATE TABLE "authtoken_token" ("key" varchar(40) NOT NULL PRIMARY KEY, "created" timestamp with time zone NOT NULL, "user_id" integer NOT NULL UNIQUE);
--
-- Create proxy model TokenProxy
--
CREATE TABLE "authtoken_token" ();
ALTER TABLE "authtoken_token" ADD CONSTRAINT "authtoken_token_user_id_35299eff_fk_auth_user_id" FOREIGN KEY ("user_id") REFERENCES "auth_user" ("id") DEFERRABLE INITIALLY DEFERRED;
CREATE INDEX "authtoken_token_key_10f0b77e_like" ON "authtoken_token" ("key" varchar_pattern_ops);
--

@saran-greytip saran-greytip changed the title When 'rest_framework.authtoken' is included get the error pq: relation "authtoken_token" already exists When the app 'rest_framework.authtoken' is included in INSTALLED_APPS we get the error pq: relation "authtoken_token" already exists Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant