ALTER TABLE <table name> WITH NOCHECK
ADD CONSTRAINT attachments_user_id_fkey FOREIGN KEY (user_id)
REFERENCES public.users (id) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION;
The above query is throwing the following error ERROR: syntax error at or near "WITH NOCHECK"
That appears to be SQL Server syntax. PostgreSQL doesn't support that WITH NOCHECK, I think you want:
ALTER TABLE <table name>
ADD CONSTRAINT attachments_user_id_fkey FOREIGN KEY (user_id)
REFERENCES public.users (id) NOT VALID
You'll have to check the documentation to see if there are equivalents for the rest of the options you're trying to use.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With