-
Notifications
You must be signed in to change notification settings - Fork 0
Home
sametcn99 edited this page Jan 22, 2025
·
3 revisions
- Navigate to the scripts directory.
- Add execute permissions to the script using:
chmod +x script_name.sh
. - Run the script using:
./script_name.sh
.
- Open the Command Palette by pressing
Ctrl+Shift+P
. - Type
Run Task
and select it from the dropdown menu. - Choose your task from the list of available tasks.
- Open the Run and Debug Panel by pressing
Ctrl+Shift+D
. - Select a configuration from the dropdown.
- Press the green play button (or
F5
) to start running the application.
Bun is an all-in-one JavaScript runtime & toolkit designed for speed, complete with a bundler, test runner, and Node.js-compatible package manager. Install it globally using:
npm install -g bun
This script is written in PL/pgSQL and allows you to truncate all tables in the public schema of a PostgreSQL database. It removes all data from the tables, including those with foreign key dependencies, using the CASCADE option. This is particularly useful for resetting test or development environments.
To execute the script, simply run it in your PostgreSQL client or management tool (e.g., psql).
DO $$
DECLARE
table_name TEXT;
BEGIN
FOR table_name IN
SELECT tablename
FROM pg_tables
WHERE schemaname = 'public'
LOOP
EXECUTE 'TRUNCATE TABLE ' || quote_ident(table_name) || ' CASCADE';
END LOOP;
END
$$;
- This script permanently deletes all data in the public schema tables. Make sure to back up your data if necessary.
- Only use this in non-production environments unless you are certain about the consequences.