Branchwell

AI Resource Pro / website / scripts / drop-tool-count-column.sql

1-- SQL to drop the tool_count column from the categories table if it's no longer needed
2
3-- First, check if the column exists to prevent errors
4DO $$
5BEGIN
6 IF EXISTS (
7 SELECT 1
8 FROM information_schema.columns
9 WHERE table_schema = 'public'
10 AND table_name = 'categories'
11 AND column_name = 'tool_count'
12 ) THEN
13 -- Drop the column
14 ALTER TABLE categories
15 DROP COLUMN tool_count;
16
17 RAISE NOTICE 'Column tool_count has been dropped from categories table';
18 ELSE
19 RAISE NOTICE 'Column tool_count does not exist in categories table';
20 END IF;
21END $$;
22
23-- Verify the current structure
24SELECT column_name, data_type, is_nullable
25FROM information_schema.columns
26WHERE table_schema = 'public'
27AND table_name = 'categories'
28ORDER BY ordinal_position;