Don't recreate indexes if they already exist

This commit is contained in:
Neil Alexander 2021-07-28 14:41:14 +01:00
parent cd59f54af7
commit 8e55c74334
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
4 changed files with 4 additions and 4 deletions

View file

@ -28,7 +28,7 @@ CREATE TABLE IF NOT EXISTS keyserver_cross_signing_keys (
stream_id BIGINT NOT NULL stream_id BIGINT NOT NULL
); );
CREATE UNIQUE INDEX keyserver_cross_signing_keys_idx ON keyserver_cross_signing_keys(user_id, key_type, stream_id); CREATE UNIQUE INDEX IF NOT EXISTS keyserver_cross_signing_keys_idx ON keyserver_cross_signing_keys(user_id, key_type, stream_id);
` `
type crossSigningKeysStatements struct { type crossSigningKeysStatements struct {

View file

@ -29,7 +29,7 @@ CREATE TABLE IF NOT EXISTS keyserver_cross_signing_sigs (
signature TEXT NOT NULL signature TEXT NOT NULL
); );
CREATE UNIQUE INDEX keyserver_cross_signing_sigs_idx ON keyserver_cross_signing_sigs(user_id, target_user_id, target_device_id); CREATE UNIQUE INDEX IF NOT EXISTS keyserver_cross_signing_sigs_idx ON keyserver_cross_signing_sigs(user_id, target_user_id, target_device_id);
` `
type crossSigningSigsStatements struct { type crossSigningSigsStatements struct {

View file

@ -28,7 +28,7 @@ CREATE TABLE IF NOT EXISTS keyserver_cross_signing_keys (
stream_id BIGINT NOT NULL stream_id BIGINT NOT NULL
); );
CREATE UNIQUE INDEX keyserver_cross_signing_keys_idx ON keyserver_cross_signing_keys(user_id, key_type, stream_id); CREATE UNIQUE INDEX IF NOT EXISTS keyserver_cross_signing_keys_idx ON keyserver_cross_signing_keys(user_id, key_type, stream_id);
` `
type crossSigningKeysStatements struct { type crossSigningKeysStatements struct {

View file

@ -29,7 +29,7 @@ CREATE TABLE IF NOT EXISTS keyserver_cross_signing_sigs (
signature TEXT NOT NULL signature TEXT NOT NULL
); );
CREATE UNIQUE INDEX keyserver_cross_signing_sigs_idx ON keyserver_cross_signing_sigs(user_id, target_user_id, target_device_id); CREATE UNIQUE INDEX IF NOT EXISTS keyserver_cross_signing_sigs_idx ON keyserver_cross_signing_sigs(user_id, target_user_id, target_device_id);
` `
type crossSigningSigsStatements struct { type crossSigningSigsStatements struct {