Delete an extension from the PostgreSQL database
Remove extension records and related data directly from the PostgreSQL database when the administrator API is not available or when you need to clean up specific data. If the extension uses local storage, you must also remove its files from the Open VSX server pod.
-
You have access to the cluster where the Open VSX registry is deployed in the
openvsxnamespace. -
You have the
kubectltool installed. -
You know the namespace name and extension name that you want to delete.
-
Open a command prompt in the PostgreSQL pod and connect to the database:
export POSTGRESQL_POD_NAME=$(kubectl get pods -n openvsx \ -o jsonpath="{.items[*].metadata.name}" | tr ' ' '\n' | grep '^postgresql' | head -n 1) kubectl exec -it $POSTGRESQL_POD_NAME -n openvsx -- /bin/bashInside the pod, run
psql:psqlAt the
postgres=#prompt, connect to the database:\c openvsxYou are now connected to the
openvsxdatabase as thepostgresuser. -
Find the namespace ID and extension ID:
Identify the extension publisher. Replace
<namespace_name>with the actual publisher name:SELECT id, name FROM namespace WHERE name = '<namespace_name>';Identify the extension ID. Replace
<namespace_id>and<extension_name>with the values from the previous query:SELECT id, name, namespace_id FROM extension WHERE namespace_id = <namespace_id> AND name = '<extension_name>';Note the ID of the extension to use as
<extension_id>in the next steps. -
Optional: Preview extension versions and file resources:
Preview the versions:
SELECT id, version, pre_release, semver_pre_release, semver_is_pre_release FROM extension_version WHERE extension_id = <extension_id> ORDER BY timestamp DESC;Preview the file resources:
SELECT id, name, type, storage_type FROM file_resource WHERE extension_id = <extension_id> ORDER BY id;If the
storage_typevalue islocal, you must also remove the extension files from the file system on the Open VSX server pod. -
Delete the extension from the database:
Run the following commands in a single transaction. Replace
<extension_id>with the extension ID from step 2.BEGIN; -- 1. Delete all file resources for the extension DELETE FROM file_resource WHERE extension_id = <extension_id>; -- 2. Delete all extension reviews DELETE FROM extension_review WHERE extension_id = <extension_id>; -- 3. Delete all versions of the extension DELETE FROM extension_version WHERE extension_id = <extension_id>; -- 4. Delete the extension entry itself DELETE FROM extension WHERE id = <extension_id>; COMMIT;Run these commands in order within one transaction. Do not skip the
COMMITcommand, or the system does not apply the changes. -
If the extension used local storage, remove the extension files from the Open VSX server pod:
Get the Open VSX server pod name:
export OPENVSX_POD_NAME=$(kubectl get pods -n openvsx -o jsonpath="{.items[*].metadata.name}" | tr ' ' '\n' | grep '^openvsx-server' | head -n 1)Delete the extension folder:
kubectl exec -it $OPENVSX_POD_NAME -n openvsx -- /bin/bash -c "rm -rf /tmp/extensions/<publisher>/<extension>"
-
Refresh your Open VSX registry and verify that the extension no longer appears in the gallery.