I'm using SQLite, which doesn't support adding a constraint to an existing table.
So I can't do something like this (just as an example):
ALTER TABLE [Customer]
ADD CONSTRAINT specify_either_phone_or_email
CHECK (([Phone] IS NOT NULL) OR ([Email] IS NOT NULL));
Are there any workarounds for this scenario?
I know:
- I can add a constraint for a new table, but it isn't new (and it's generated by my ORM, EF Core)
- I can do a "table rebuild" (rename table, create new one, copy old data, drop temp table) but that seems really complex
Ideas
- Can I somehow make a copy of the table into a new table, with some schema changes?
- Or "get" the schema somehow, and edit it in a SQL script, then add a table with that schema?