20 lines
833 B
SQL
20 lines
833 B
SQL
-- Migration to create device lifecycle policies table
|
|
CREATE TABLE IF NOT EXISTS device_lifecycle_policies (
|
|
id SERIAL PRIMARY KEY,
|
|
device_type VARCHAR(255) NOT NULL UNIQUE,
|
|
expected_months INTEGER NOT NULL,
|
|
created_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at TIMESTAMP WITH TIME ZONE DEFAULT CURRENT_TIMESTAMP,
|
|
is_deleted BOOLEAN DEFAULT FALSE,
|
|
deleted_at TIMESTAMP WITH TIME ZONE
|
|
);
|
|
|
|
-- Seed some default policies based on common MSP standards
|
|
INSERT INTO device_lifecycle_policies (device_type, expected_months) VALUES
|
|
('Workstation', 48), -- 4 years
|
|
('Desktop', 60), -- 5 years
|
|
('Laptop', 48), -- 4 years
|
|
('Server', 60), -- 5 years
|
|
('Network', 60), -- 5 years
|
|
('Firewall', 60) -- 5 years
|
|
ON CONFLICT (device_type) DO NOTHING;
|