Assign production plans to Graphs users

This commit is contained in:
Cauê Faleiros
2026-08-25 13:40:52 -03:00
parent d14f7e315f
commit c259ddea29
8 changed files with 147 additions and 24 deletions

View File

@@ -792,6 +792,13 @@ const initDB = async () => {
ALTER COLUMN updated_at SET DEFAULT CURRENT_TIMESTAMP;
`).catch(() => {});
// A production plan is operated by a Graphs user. The ID link will let
// role-based assignments be added without changing historical plans.
await pool.query(`
ALTER TABLE production_plans
ADD COLUMN IF NOT EXISTS responsible_user_id INTEGER REFERENCES app_users(id) ON DELETE SET NULL;
`).catch(() => {});
await pool.query(`
ALTER TABLE stock_campaign_queue
ALTER COLUMN created_at TYPE TIMESTAMPTZ USING created_at AT TIME ZONE 'America/Sao_Paulo',