* B2B-87: add company statistics consent * add toggle for company statistics consent under profile * add toggle for company statistics consent under profile * add audit logging to accounts * change policy * add audit logging to accounts * remove full account data query and just query the entire account every time * add comment about consent toggle * make constants hardcoded, as dynamic ones do not work * add back pending check --------- Co-authored-by: Helena <helena@Helenas-MacBook-Pro.local>
30 lines
660 B
SQL
30 lines
660 B
SQL
ALTER TABLE "public"."invitations" ADD COLUMN IF NOT EXISTS personal_code text;
|
|
|
|
DO $$
|
|
BEGIN
|
|
IF NOT EXISTS (
|
|
SELECT 1
|
|
FROM pg_constraint
|
|
WHERE conname = 'accounts_personal_code_unique'
|
|
) THEN
|
|
ALTER TABLE public.accounts
|
|
ADD CONSTRAINT accounts_personal_code_unique UNIQUE (personal_code);
|
|
END IF;
|
|
END$$;
|
|
|
|
ALTER TABLE public.invitations
|
|
ALTER COLUMN personal_code TYPE text;
|
|
|
|
DO $$
|
|
BEGIN
|
|
IF NOT EXISTS (
|
|
SELECT 1
|
|
FROM pg_constraint
|
|
WHERE conname = 'invitations_personal_code_unique'
|
|
) THEN
|
|
ALTER TABLE public.invitations
|
|
ADD CONSTRAINT invitations_personal_code_unique UNIQUE (personal_code);
|
|
END IF;
|
|
END$$;
|
|
|