File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -76,9 +76,18 @@ ADD CONSTRAINT hello_type_check CHECK(type = ANY(ARRAY['a']));
7676```
7777
7878
79- ## Patterns
79+ ## Column patterns
8080
81- - two columns must be null or vice versa
81+ - two columns must be null or vice versa (a AND b)
8282- three or more columns must be null or vice versa (create one new column flag to indicate those exists, or better, put them in another table)
8383- is draft and published at(hint, you only need one)
8484- active and deleted at (maybe both)
85+ - usecase: publishing products. when is no longer draft, all the columns must be filled, otherwise errors.
86+ - XOR for polymorphic associations, vs table inheritance
87+
88+
89+ # Row patterns
90+
91+ - min max rows
92+ - at least n row fulfilling condition (usecase: one pending status booking)
93+ - max one row with condition (unique, and partial unique)
You can’t perform that action at this time.
0 commit comments