Skip to content

Commit 784ad5f

Browse files
committed
experiment: add dependencies and tables for allauth
1 parent d233a3d commit 784ad5f

File tree

2 files changed

+253
-0
lines changed

2 files changed

+253
-0
lines changed

pyproject.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ dependencies = [
6363

6464
[project.optional-dependencies]
6565
ldap = ["python-ldap==3.4.5"] # optional for LDAP authentication, requires libldap (OpenLDAP) to build
66+
allauth-mfa = [
67+
"django-allauth[mfa]",
68+
]
69+
allauth-social = [
70+
"django-allauth[socialaccount]",
71+
]
6672
docs = ["sphinx_rtd_theme>=2.0.0"]
6773

6874
[dependency-groups]
Lines changed: 247 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,247 @@
1+
-- Tables for django-allauth[mfa,socialaccount]
2+
3+
-- account_emailaddress
4+
5+
CREATE TABLE profiles.account_emailaddress (
6+
id integer NOT NULL,
7+
email character varying(254) NOT NULL,
8+
verified boolean NOT NULL,
9+
"primary" boolean NOT NULL,
10+
user_id integer NOT NULL
11+
);
12+
13+
14+
ALTER TABLE profiles.account_emailaddress OWNER TO nav;
15+
16+
17+
ALTER TABLE profiles.account_emailaddress ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
18+
SEQUENCE NAME profiles.account_emailaddress_id_seq
19+
START WITH 1
20+
INCREMENT BY 1
21+
NO MINVALUE
22+
NO MAXVALUE
23+
CACHE 1
24+
);
25+
26+
27+
ALTER TABLE ONLY profiles.account_emailaddress
28+
ADD CONSTRAINT account_emailaddress_pkey PRIMARY KEY (id);
29+
30+
31+
ALTER TABLE ONLY profiles.account_emailaddress
32+
ADD CONSTRAINT account_emailaddress_user_id_email_987c8728_uniq UNIQUE (user_id, email);
33+
34+
35+
CREATE INDEX account_emailaddress_email_03be32b2 ON profiles.account_emailaddress USING btree (email);
36+
37+
38+
CREATE INDEX account_emailaddress_email_03be32b2_like ON profiles.account_emailaddress USING btree (email varchar_pattern_ops);
39+
40+
41+
CREATE INDEX account_emailaddress_user_id_2c513194 ON profiles.account_emailaddress USING btree (user_id);
42+
43+
44+
CREATE UNIQUE INDEX unique_primary_email ON profiles.account_emailaddress USING btree (user_id, "primary") WHERE "primary";
45+
46+
47+
CREATE UNIQUE INDEX unique_verified_email ON profiles.account_emailaddress USING btree (email) WHERE verified;
48+
49+
50+
ALTER TABLE ONLY profiles.account_emailaddress
51+
ADD CONSTRAINT account_emailaddress_user_id_2c513194_fk_account_id FOREIGN KEY (user_id) REFERENCES profiles.account(id) DEFERRABLE INITIALLY DEFERRED;
52+
53+
-- account_emailconfirmation
54+
55+
CREATE TABLE profiles.account_emailconfirmation (
56+
id integer NOT NULL,
57+
created timestamp with time zone NOT NULL,
58+
sent timestamp with time zone,
59+
key character varying(64) NOT NULL,
60+
email_address_id integer NOT NULL
61+
);
62+
63+
64+
ALTER TABLE profiles.account_emailconfirmation OWNER TO nav;
65+
66+
67+
ALTER TABLE profiles.account_emailconfirmation ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
68+
SEQUENCE NAME profiles.account_emailconfirmation_id_seq
69+
START WITH 1
70+
INCREMENT BY 1
71+
NO MINVALUE
72+
NO MAXVALUE
73+
CACHE 1
74+
);
75+
76+
77+
ALTER TABLE ONLY profiles.account_emailconfirmation
78+
ADD CONSTRAINT account_emailconfirmation_key_key UNIQUE (key);
79+
80+
81+
ALTER TABLE ONLY profiles.account_emailconfirmation
82+
ADD CONSTRAINT account_emailconfirmation_pkey PRIMARY KEY (id);
83+
84+
85+
CREATE INDEX account_emailconfirmation_email_address_id_5b7f8c58 ON profiles.account_emailconfirmation USING btree (email_address_id);
86+
87+
88+
CREATE INDEX account_emailconfirmation_key_f43612bd_like ON profiles.account_emailconfirmation USING btree (key varchar_pattern_ops);
89+
90+
91+
ALTER TABLE ONLY profiles.account_emailconfirmation
92+
ADD CONSTRAINT account_emailconfirm_email_address_id_5b7f8c58_fk_account_e FOREIGN KEY (email_address_id) REFERENCES profiles.account_emailaddress(id) DEFERRABLE INITIALLY DEFERRED;
93+
94+
-- mfa_authenticator
95+
96+
CREATE TABLE profiles.mfa_authenticator (
97+
id bigint NOT NULL,
98+
type character varying(20) NOT NULL,
99+
data jsonb NOT NULL,
100+
user_id integer NOT NULL,
101+
created_at timestamp with time zone NOT NULL,
102+
last_used_at timestamp with time zone
103+
);
104+
105+
106+
ALTER TABLE profiles.mfa_authenticator OWNER TO nav;
107+
108+
109+
ALTER TABLE profiles.mfa_authenticator ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
110+
SEQUENCE NAME profiles.mfa_authenticator_id_seq
111+
START WITH 1
112+
INCREMENT BY 1
113+
NO MINVALUE
114+
NO MAXVALUE
115+
CACHE 1
116+
);
117+
118+
119+
ALTER TABLE ONLY profiles.mfa_authenticator
120+
ADD CONSTRAINT mfa_authenticator_pkey PRIMARY KEY (id);
121+
122+
123+
CREATE INDEX mfa_authenticator_user_id_0c3a50c0 ON profiles.mfa_authenticator USING btree (user_id);
124+
125+
126+
CREATE UNIQUE INDEX unique_authenticator_type ON profiles.mfa_authenticator USING btree (user_id, type) WHERE ((type)::text = ANY ((ARRAY['totp'::character varying, 'recovery_codes'::character varying])::text[]));
127+
128+
129+
ALTER TABLE ONLY profiles.mfa_authenticator
130+
ADD CONSTRAINT mfa_authenticator_user_id_0c3a50c0_fk_account_id FOREIGN KEY (user_id) REFERENCES profiles.account(id) DEFERRABLE INITIALLY DEFERRED;
131+
132+
-- socialaccount_socialaccount
133+
134+
CREATE TABLE profiles.socialaccount_socialaccount (
135+
id integer NOT NULL,
136+
provider character varying(200) NOT NULL,
137+
uid character varying(191) NOT NULL,
138+
last_login timestamp with time zone NOT NULL,
139+
date_joined timestamp with time zone NOT NULL,
140+
extra_data jsonb NOT NULL,
141+
user_id integer NOT NULL
142+
);
143+
144+
145+
ALTER TABLE profiles.socialaccount_socialaccount OWNER TO nav;
146+
147+
148+
ALTER TABLE profiles.socialaccount_socialaccount ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
149+
SEQUENCE NAME profiles.socialaccount_socialaccount_id_seq
150+
START WITH 1
151+
INCREMENT BY 1
152+
NO MINVALUE
153+
NO MAXVALUE
154+
CACHE 1
155+
);
156+
157+
158+
ALTER TABLE ONLY profiles.socialaccount_socialaccount
159+
ADD CONSTRAINT socialaccount_socialaccount_pkey PRIMARY KEY (id);
160+
161+
162+
ALTER TABLE ONLY profiles.socialaccount_socialaccount
163+
ADD CONSTRAINT socialaccount_socialaccount_provider_uid_fc810c6e_uniq UNIQUE (provider, uid);
164+
165+
166+
CREATE INDEX socialaccount_socialaccount_user_id_8146e70c ON profiles.socialaccount_socialaccount USING btree (user_id);
167+
168+
169+
ALTER TABLE ONLY profiles.socialaccount_socialaccount
170+
ADD CONSTRAINT socialaccount_social_user_id_8146e70c_fk_account FOREIGN KEY (user_id) REFERENCES profiles.account(id) DEFERRABLE INITIALLY DEFERRED;
171+
172+
-- socialaccount_socialapp
173+
174+
CREATE TABLE profiles.socialaccount_socialapp (
175+
id integer NOT NULL,
176+
provider character varying(30) NOT NULL,
177+
name character varying(40) NOT NULL,
178+
client_id character varying(191) NOT NULL,
179+
secret character varying(191) NOT NULL,
180+
key character varying(191) NOT NULL,
181+
provider_id character varying(200) NOT NULL,
182+
settings jsonb NOT NULL
183+
);
184+
185+
186+
ALTER TABLE profiles.socialaccount_socialapp OWNER TO nav;
187+
188+
189+
ALTER TABLE profiles.socialaccount_socialapp ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
190+
SEQUENCE NAME profiles.socialaccount_socialapp_id_seq
191+
START WITH 1
192+
INCREMENT BY 1
193+
NO MINVALUE
194+
NO MAXVALUE
195+
CACHE 1
196+
);
197+
198+
199+
ALTER TABLE ONLY profiles.socialaccount_socialapp
200+
ADD CONSTRAINT socialaccount_socialapp_pkey PRIMARY KEY (id);
201+
202+
-- socialaccount_socialapp
203+
204+
205+
CREATE TABLE profiles.socialaccount_socialtoken (
206+
id integer NOT NULL,
207+
token text NOT NULL,
208+
token_secret text NOT NULL,
209+
expires_at timestamp with time zone,
210+
account_id integer NOT NULL,
211+
app_id integer
212+
);
213+
214+
215+
ALTER TABLE profiles.socialaccount_socialtoken OWNER TO nav;
216+
217+
218+
ALTER TABLE profiles.socialaccount_socialtoken ALTER COLUMN id ADD GENERATED BY DEFAULT AS IDENTITY (
219+
SEQUENCE NAME profiles.socialaccount_socialtoken_id_seq
220+
START WITH 1
221+
INCREMENT BY 1
222+
NO MINVALUE
223+
NO MAXVALUE
224+
CACHE 1
225+
);
226+
227+
228+
ALTER TABLE ONLY profiles.socialaccount_socialtoken
229+
ADD CONSTRAINT socialaccount_socialtoken_app_id_account_id_fca4e0ac_uniq UNIQUE (app_id, account_id);
230+
231+
232+
ALTER TABLE ONLY profiles.socialaccount_socialtoken
233+
ADD CONSTRAINT socialaccount_socialtoken_pkey PRIMARY KEY (id);
234+
235+
236+
CREATE INDEX socialaccount_socialtoken_account_id_951f210e ON profiles.socialaccount_socialtoken USING btree (account_id);
237+
238+
239+
CREATE INDEX socialaccount_socialtoken_app_id_636a42d7 ON profiles.socialaccount_socialtoken USING btree (app_id);
240+
241+
242+
ALTER TABLE ONLY profiles.socialaccount_socialtoken
243+
ADD CONSTRAINT socialaccount_social_account_id_951f210e_fk_socialacc FOREIGN KEY (account_id) REFERENCES profiles.socialaccount_socialaccount(id) DEFERRABLE INITIALLY DEFERRED;
244+
245+
246+
ALTER TABLE ONLY profiles.socialaccount_socialtoken
247+
ADD CONSTRAINT socialaccount_social_app_id_636a42d7_fk_socialacc FOREIGN KEY (app_id) REFERENCES profiles.socialaccount_socialapp(id) DEFERRABLE INITIALLY DEFERRED;

0 commit comments

Comments
 (0)