diff --git a/SQL/postgres.initial.sql b/SQL/postgres.initial.sql index 2363c6c..9ccfab3 100644 --- a/SQL/postgres.initial.sql +++ b/SQL/postgres.initial.sql @@ -1,4 +1,13 @@ -CREATE TABLE ident_switch +-- Patched version of SQL/postgres.initial.sql for gecka/ident-switch. +-- Commit this into your Gitea fork at the same path, replacing the +-- upstream file. Only two changes from upstream: +-- 1. CREATE TABLE / CREATE INDEX -> IF NOT EXISTS +-- 2. INSERT INTO system -> upsert via ON CONFLICT +-- This makes the script safe to re-run against an already-migrated +-- database, which happens on every container restart unless +-- /var/www/html is persisted (composer re-installs "fresh" each time). + +CREATE TABLE IF NOT EXISTS ident_switch ( id serial @@ -82,8 +91,9 @@ CREATE TABLE ident_switch UNIQUE (user_id, label) ); -CREATE INDEX IX_ident_switch_user_id ON ident_switch(user_id); -CREATE INDEX IX_ident_switch_iid ON ident_switch(iid); -CREATE INDEX IX_ident_switch_parent_id ON ident_switch(parent_id); +CREATE INDEX IF NOT EXISTS IX_ident_switch_user_id ON ident_switch(user_id); +CREATE INDEX IF NOT EXISTS IX_ident_switch_iid ON ident_switch(iid); +CREATE INDEX IF NOT EXISTS IX_ident_switch_parent_id ON ident_switch(parent_id); -INSERT INTO system (name, value) VALUES ('ident_switch-version', '2026021000'); +INSERT INTO system (name, value) VALUES ('ident_switch-version', '2026021000') +ON CONFLICT (name) DO UPDATE SET value = EXCLUDED.value; \ No newline at end of file diff --git a/composer.json b/composer.json index d0c1980..f0c2681 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "gecka/ident-switch", + "name": "senior/s-ident-switch", "type": "roundcube-plugin", "description": "This plugin allows users to switch between different accounts (including remote) in single Roundcube session.", "homepage": "https://github.com/Gecka-Apps/roundcube-ident_switch", diff --git a/ident_switch-switch.js b/ident_switch-switch.js index ffe42c2..cb95823 100644 --- a/ident_switch-switch.js +++ b/ident_switch-switch.js @@ -2,7 +2,7 @@ * ident_switch - Account switcher UI and new mail notifications. * * Places the hidden