schema.sql: Add missing cascades

These cascades were added in the ID unification migration.
1 files changed, 8 insertions(+), 8 deletions(-)

M schema.sql
M schema.sql +8 -8
@@ 46,7 46,7 @@ CREATE TABLE repository (
 	description character varying(1024),
 	path character varying(1024),
 	visibility visibility NOT NULL,
-	owner_id integer NOT NULL REFERENCES "user"(id),
+	owner_id integer NOT NULL REFERENCES "user"(id) ON DELETE CASCADE,
 	is_non_publishing boolean DEFAULT false NOT NULL,
 	readme character varying,
 	CONSTRAINT uq_repo_owner_id_name UNIQUE (owner_id, name)

          
@@ 57,7 57,7 @@ CREATE TABLE access (
 	created timestamp without time zone NOT NULL,
 	updated timestamp without time zone NOT NULL,
 	mode character varying NOT NULL,
-	user_id integer NOT NULL REFERENCES "user"(id),
+	user_id integer NOT NULL REFERENCES "user"(id) ON DELETE CASCADE,
 	repo_id integer NOT NULL REFERENCES repository(id) ON DELETE CASCADE,
 	CONSTRAINT uq_access_user_id_repo_id UNIQUE (user_id, repo_id)
 );

          
@@ 67,7 67,7 @@ CREATE TABLE redirect (
 	created timestamp without time zone NOT NULL,
 	name character varying(256) NOT NULL,
 	path character varying(1024),
-	owner_id integer NOT NULL REFERENCES "user"(id),
+	owner_id integer NOT NULL REFERENCES "user"(id) ON DELETE CASCADE,
 	new_repo_id integer NOT NULL REFERENCES repository(id) ON DELETE CASCADE
 );
 

          
@@ 84,7 84,7 @@ CREATE TABLE gql_user_wh_sub (
 	client_id uuid,
 	expires timestamp without time zone,
 	node_id character varying,
-	user_id integer NOT NULL REFERENCES "user"(id),
+	user_id integer NOT NULL REFERENCES "user"(id) ON DELETE CASCADE,
 	CONSTRAINT gql_user_wh_sub_auth_method_check
 		CHECK ((auth_method = ANY (ARRAY['OAUTH2'::auth_method, 'INTERNAL'::auth_method]))),
 	CONSTRAINT gql_user_wh_sub_check

          
@@ 114,7 114,7 @@ CREATE TABLE gql_user_wh_delivery (
 -- Legacy SSH key table, to be fetched from meta.sr.ht instead (TODO: Remove)
 CREATE TABLE sshkey (
 	id serial PRIMARY KEY,
-	user_id integer NOT NULL REFERENCES "user"(id),
+	user_id integer NOT NULL REFERENCES "user"(id) ON DELETE CASCADE,
 	meta_id integer NOT NULL,
 	key character varying(4096) NOT NULL,
 	fingerprint character varying(512) NOT NULL

          
@@ 137,7 137,7 @@ CREATE TABLE oauthtoken (
 	token_hash character varying(128) NOT NULL,
 	token_partial character varying(8) NOT NULL,
 	scopes character varying(512) NOT NULL,
-	user_id integer REFERENCES "user"(id)
+	user_id integer REFERENCES "user"(id) ON DELETE CASCADE
 );
 
 -- Legacy webhooks (TODO: Remove)

          
@@ 146,7 146,7 @@ CREATE TABLE user_webhook_subscription (
 	created timestamp without time zone NOT NULL,
 	url character varying(2048) NOT NULL,
 	events character varying NOT NULL,
-	user_id integer REFERENCES "user"(id),
+	user_id integer REFERENCES "user"(id) ON DELETE CASCADE,
 	token_id integer REFERENCES oauthtoken(id)
 );
 

          
@@ 169,7 169,7 @@ CREATE TABLE repo_webhook_subscription (
 	created timestamp without time zone NOT NULL,
 	url character varying(2048) NOT NULL,
 	events character varying NOT NULL,
-	user_id integer REFERENCES "user"(id),
+	user_id integer REFERENCES "user"(id) ON DELETE CASCADE,
 	token_id integer REFERENCES oauthtoken(id),
 	repo_id integer REFERENCES repository(id),
 	sync boolean DEFAULT false NOT NULL