Skip to content

Commit

Permalink
Make the foreig key from last login table be ON DELETE CASCADE
Browse files Browse the repository at this point in the history
Since this one is not managed inside Django, it doesn't know what to do
with it when deleting, so just make postgres handle it.
  • Loading branch information
mhagander committed Dec 17, 2023
1 parent addaef2 commit 115586c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pgweb/account/migrations/0004_cauth_last_login.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Migration(migrations.Migration):

operations = [
migrations.RunSQL("""CREATE TABLE account_communityauthlastlogin (
user_id int NOT NULL REFERENCES auth_user(id) DEFERRABLE INITIALLY DEFERRED,
user_id int NOT NULL REFERENCES auth_user(id) DEFERRABLE INITIALLY DEFERRED ON DELETE CASCADE,
site_id int NOT NULL REFERENCES account_communityauthsite (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED,
lastlogin timestamptz NOT NULL,
logincount bigint NOT NULL,
Expand Down

0 comments on commit 115586c

Please sign in to comment.