fix: renumber migrations 0042-0045 after rebase onto main
Some checks failed
Build & Release / build (push) Failing after 1m53s
Some checks failed
Build & Release / build (push) Failing after 1m53s
Main added 0041_app_settings, so branch migrations shift up by one. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
20
packages/backend/src/db/migrations/0043_user-pin.sql
Normal file
20
packages/backend/src/db/migrations/0043_user-pin.sql
Normal file
@@ -0,0 +1,20 @@
|
||||
ALTER TABLE "user" ADD COLUMN IF NOT EXISTS "pin_hash" varchar(255);
|
||||
ALTER TABLE "user" ADD COLUMN IF NOT EXISTS "employee_number" varchar(20) UNIQUE;
|
||||
|
||||
-- Auto-assign employee numbers to existing users
|
||||
DO $$ DECLARE r RECORD; num INT := 1001;
|
||||
BEGIN
|
||||
FOR r IN (SELECT id FROM "user" WHERE employee_number IS NULL ORDER BY created_at) LOOP
|
||||
UPDATE "user" SET employee_number = num::text WHERE id = r.id;
|
||||
num := num + 1;
|
||||
END LOOP;
|
||||
END $$;
|
||||
|
||||
-- Seed POS config
|
||||
INSERT INTO "app_config" ("key", "value", "description") VALUES
|
||||
('pos_lock_timeout', '15', 'POS auto-lock timeout in minutes (0 to disable)'),
|
||||
('receipt_header', '', 'Text shown below logo on receipts'),
|
||||
('receipt_footer', '', 'Thank you message at bottom of receipt'),
|
||||
('receipt_return_policy', '', 'Return policy text on receipt (blank to hide)'),
|
||||
('receipt_social', '', 'Website or social media shown on receipt')
|
||||
ON CONFLICT ("key") DO NOTHING;
|
||||
Reference in New Issue
Block a user