Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Ask for a csv file containing the domain user account & the email address - which should be the name of the user after Azure AD integration.

Code Block
languagesql
-- create a table
CREATE TABLE annotations_lookup
(
  account character varying,
  email character varying
)

-- import the data
COPY annotations_lookup from E'E:\\Temp\\annotations_users.csv' WITH DELIMITER ',' CSV HEADER QUOTE '"';

-- update the annotations
UPDATE annotations.features SET username = annotations_lookup.email FROM annotations_lookup 
WHERE features.username = annotations_lookup.account;
UPDATE annotations.layers SET "owner" = annotations_lookup.email FROM annotations_lookup
WHERE layers."owner" = annotations_lookup.account;
UPDATE annotations.layers SET "lasteditedby" = annotations_lookup.email FROM annotations_lookup
WHERE layers."lasteditedby" = annotations_lookup.account;
UPDATE annotations.layers_access SET username = annotations_lookup.email FROM annotations_lookup
WHERE layers_access.username = annotations_lookup.account;

...