I was wondering if there is a nice IF NOT EXISTS for checking columns and indexes in SQLite, or do I need to bring back the entire database schema and validate against that?
See Question&Answers more detail:osI was wondering if there is a nice IF NOT EXISTS for checking columns and indexes in SQLite, or do I need to bring back the entire database schema and validate against that?
See Question&Answers more detail:osThere is a system catalog table called sqlite_master that you can use to check index (or other) names:
SELECT name FROM sqlite_master WHERE type='index' ORDER BY name;
You can use a pragma to get the indexed columns:
PRAGMA index_info(index-name);
And this one to get the column names for a table:
PRAGMA table_info(table-name);