fix: create index if it doesn't exist

Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
Akhil Narang 2025-09-30 22:14:55 +05:30
parent 5441658b39
commit 0fab9a0bc8
No known key found for this signature in database
GPG key ID: 9DCC61E211BF645F

View file

@ -125,7 +125,7 @@ class SQLiteTable(DBTable):
if self.meta.sort_field == "modified" and not frappe.db.get_column_index(
self.table_name, "modified", unique=False
):
index_queries.append(f"CREATE INDEX `modified` ON `{self.table_name}` (`modified`)")
index_queries.append(f"CREATE INDEX IF NOT EXISTS `modified` ON `{self.table_name}` (`modified`)")
for query in index_queries:
frappe.db.sql_ddl(query)