Files
aura-crm/production/backend/migrations/061_common_faults.sql
T

32 lines
1.3 KiB
SQL

-- +goose Up
-- Quick-pick common problem descriptions — same "flat, any-staff-can-add"
-- shape as device_brands (019_device_catalog_warranty_prizes.sql): a label
-- carries no structural risk the way a device_groups prefix does, so it
-- doesn't need owner-only gating. Unscoped by device type deliberately —
-- staff pick whichever ones fit, same as how device_brands isn't scoped to
-- a device_group either. Orders don't reference this table at all; a click
-- just inserts the label text into problem_description, same one-way
-- "suggest, then it's plain text" relationship RecentModels already has
-- with device_model.
CREATE TABLE common_faults (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
label TEXT NOT NULL UNIQUE,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);
INSERT INTO common_faults (label) VALUES
('Разбит экран'),
('Не включается'),
('Не заряжается'),
('Быстро разряжается'),
('Не работает кнопка питания'),
('Не печатает / полосит'),
('Не подключается к Wi-Fi'),
('Шумит вентилятор'),
('Не читает диск / накопитель'),
('Залито жидкостью');
-- +goose Down
DROP TABLE common_faults;