-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support CHECK constraints #629
Comments
mpscholten
added a commit
that referenced
this issue
Dec 27, 2020
Added support for CHECK constraints. Fixes #629
This looks like its limited to basic inequality checks. Checks for equality Example that does work in Postgres, but not in IHP: CREATE TYPE property_type AS ENUM ('haus_buy', 'haus_rent');
CREATE TABLE properties (
id UUID DEFAULT uuid_generate_v4() PRIMARY KEY NOT NULL,
property_type property_type NOT NULL,
area_living INT NOT NULL,
area_garden INT,
rent_monthly INT DEFAULT NULL,
price INT DEFAULT NULL
);
ALTER TABLE properties ADD CONSTRAINT foobar CHECK (
(property_type = 'haus_buy'
AND area_garden IS NOT NULL
AND rent_monthly IS NULL
)
OR (property_type = 'haus_rent'
AND rent_monthly IS NOT NULL
AND price IS NULL
)
);
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: