I have a table of color schemes that a user can customize and switch between on my site. For instance a 'dark' scheme and a 'light' scheme. I want a way to update this table by first checking which user has which scheme, so I don't add a scheme/user combination twice.
| userid | schemename | background | text |
---------------------------------------------------
| 1 | dark | black | white |
| 1 | light | white | grey |
| 2 | dark | black | white |
| 2 | light | white | grey |
etc.
I have an update script that keeps these schemes in sync with the master schemes - so if the user happens to delete a scheme they can re-sync their schemes with the master. I need an insert statement that will only add in the scheme if the userid/schemename combination does not already exist in the table. Can I use an INSERT IGNORE or something similar?