Archon
Archon copied to clipboard
Improve complete_setup.sql script.
In order for the script not to crash if the trigger update_archon_settings_updated_at already exists this check could be added:
DO $$ BEGIN IF NOT EXISTS ( SELECT 1 FROM pg_trigger WHERE tgname = 'update_archon_settings_updated_at' ) THEN CREATE TRIGGER update_archon_settings_updated_at BEFORE UPDATE ON archon_settings FOR EACH ROW EXECUTE FUNCTION update_updated_at_column(); END IF; END$$;
Instead of just:
CREATE TRIGGER update_archon_settings_updated_at BEFORE UPDATE ON archon_settings FOR EACH ROW EXECUTE FUNCTION update_updated_at_column(); END IF;
Which will cause an error.
This is probably a part duplicate of #738