feat: add bump-version.sh script for version management
Automates version bumps across all version source files: - Cargo.toml (PRIMARY - workspace.package.version) - debian/changelog (prepend new entry) - debian/control (update Version field) - scripts/build-package.sh (update VERSION variable) - frontend/package.json (update version field) - Stale references check after bump Usage: ./scripts/bump-version.sh <new_version> <old_version>
This commit is contained in:
19
migrations/006_host_patch_data_unique.sql
Normal file
19
migrations/006_host_patch_data_unique.sql
Normal file
@ -0,0 +1,19 @@
|
||||
-- Migration 006: Add UNIQUE constraint on host_id in host_patch_data
|
||||
-- Clean up duplicate rows (keep latest polled_at per host) before adding constraint.
|
||||
|
||||
-- Step 1: Delete duplicate rows, keeping only the most recent poll per host
|
||||
DELETE FROM host_patch_data a
|
||||
USING host_patch_data b
|
||||
WHERE a.host_id = b.host_id
|
||||
AND a.polled_at < b.polled_at;
|
||||
|
||||
-- Step 2: Add UNIQUE constraint on host_id (idempotent)
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1 FROM pg_constraint WHERE conname = 'host_patch_data_host_id_key'
|
||||
) THEN
|
||||
ALTER TABLE host_patch_data
|
||||
ADD CONSTRAINT host_patch_data_host_id_key UNIQUE (host_id);
|
||||
END IF;
|
||||
END $$;
|
||||
Reference in New Issue
Block a user