Last active
April 6, 2018 13:57
-
-
Save mspreij/81841b4a0f9eb1a36e20955d2320536c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
We have a table with read/write permissions for every User Role / Object Type / Object Property. | |
When adding a new Property to an object we often copy the rights from an existing, similar property, with this query: | |
*/ | |
INSERT INTO rights (roleId, strType, strProperty, `read`, `write`) | |
SELECT roleId, strType, newProperty, `read`, `write` | |
JOIN (SELECT 'new property one' AS newProperty UNION SELECT 'new property two' UNION SELECT 'new property three') | |
FROM rights | |
WHERE strType = 'phdRegistrations' | |
AND strProperty = 'existingProperty'; | |
-- if we want to do this for 10 new properties (say), is there a shorter way than copy/pasting this 10 times? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment