-- Add a scopes field to users table

ALTER TABLE public.users
ADD COLUMN scopes JSONB NOT NULL DEFAULT '{
  "PROJECT": ["VIEW", "CREATE", "EDIT", "ANNOTATE", "EXPORT", "DOWNLOAD", "DELETE", "DEACTIVATE"],
  "SCENE": ["VIEW", "CREATE", "EDIT", "ANNOTATE", "EXPORT", "DOWNLOAD", "DELETE", "DEACTIVATE"],
  "DATASOURCE": ["VIEW", "CREATE", "EDIT", "ANNOTATE", "EXPORT", "DOWNLOAD", "DELETE", "DEACTIVATE"],
  "SHAPE": ["VIEW", "CREATE", "EDIT", "ANNOTATE", "EXPORT", "DOWNLOAD", "DELETE", "DEACTIVATE"],
  "WORKSPACE": ["VIEW", "CREATE", "EDIT", "ANNOTATE", "EXPORT", "DOWNLOAD", "DELETE", "DEACTIVATE"],
  "TEMPLATE": ["VIEW", "CREATE", "EDIT", "ANNOTATE", "EXPORT", "DOWNLOAD", "DELETE", "DEACTIVATE"],
  "ANALYSIS": ["VIEW", "CREATE", "EDIT", "ANNOTATE", "EXPORT", "DOWNLOAD", "DELETE", "DEACTIVATE"],
  "PLATFORM": ["VIEW", "CREATE", "EDIT", "ANNOTATE", "EXPORT", "DOWNLOAD", "DELETE", "DEACTIVATE"],
  "ORGANIZATION": ["VIEW", "CREATE", "EDIT", "ANNOTATE", "EXPORT", "DOWNLOAD", "DELETE", "DEACTIVATE"],
  "TEAM": ["VIEW", "CREATE", "EDIT", "ANNOTATE", "EXPORT", "DOWNLOAD", "DELETE", "DEACTIVATE"],
  "USER": ["VIEW", "CREATE", "EDIT", "ANNOTATE", "EXPORT", "DOWNLOAD", "DELETE", "DEACTIVATE"],
  "UPLOAD": ["VIEW", "CREATE", "EDIT", "ANNOTATE", "EXPORT", "DOWNLOAD", "DELETE", "DEACTIVATE"],
  "EXPORT": ["VIEW", "CREATE", "EDIT", "ANNOTATE", "EXPORT", "DOWNLOAD", "DELETE", "DEACTIVATE"],
  "FEED": ["VIEW", "CREATE", "EDIT", "ANNOTATE", "EXPORT", "DOWNLOAD", "DELETE", "DEACTIVATE"],
  "MAPTOKEN": ["VIEW", "CREATE", "EDIT", "ANNOTATE", "EXPORT", "DOWNLOAD", "DELETE", "DEACTIVATE"],
  "LICENSE": ["VIEW", "CREATE", "EDIT", "ANNOTATE", "EXPORT", "DOWNLOAD", "DELETE", "DEACTIVATE"],
  "TOOLTAG": ["VIEW", "CREATE", "EDIT", "ANNOTATE", "EXPORT", "DOWNLOAD", "DELETE", "DEACTIVATE"],
  "TOOLCATEGORY": ["VIEW", "CREATE", "EDIT", "ANNOTATE", "EXPORT", "DOWNLOAD", "DELETE", "DEACTIVATE"],
  "AOI": ["VIEW", "CREATE", "EDIT", "ANNOTATE", "EXPORT", "DOWNLOAD", "DELETE", "DEACTIVATE"]
}'::jsonb;

Add a migration to add scopes field to users table
Add a migration to add scopes field to users table
