🗃️ Create index tables only if it not exists

This commit is contained in:
Maxim Lebedev 2023-12-20 07:27:06 +06:00
parent 2ec9567c24
commit 90d4e4d071
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
2 changed files with 2 additions and 2 deletions

View File

@ -62,7 +62,7 @@ const (
secret TEXT,
PRIMARY KEY (topic, callback)
)`
queryIndex string = `CREATE INDEX idx_subscription ON ` + table + ` (topic, callback);`
queryIndex string = `CREATE INDEX IF NOT EXISTS idx_subscription ON ` + table + ` (topic, callback);`
queryCreate string = `INSERT INTO ` + table + ` (created_at, updated_at, synced_at, delete_at, topic, ` +
`callback, secret)
VALUES (:created_at, :updated_at, :synced_at, :delete_at, :topic, :callback, :secret);`

View File

@ -52,7 +52,7 @@ const (
content_type TEXT,
content BLOB
)`
queryIndex string = `CREATE INDEX idx_topic ON ` + table + ` (url);`
queryIndex string = `CREATE INDEX IF NOT EXISTS idx_topic ON ` + table + ` (url);`
queryCreate string = `INSERT INTO ` + table + ` (created_at, updated_at, url, content_type, content)
VALUES (:created_at, :updated_at, :url, :content_type, :content);`
queryFetch string = `SELECT * FROM ` + table + `;`