1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00
bitwarden-server/util/PostgresMigrations/HelperScripts/2022-03-01_00_Up_MigrateOrganizationApiKeys.psql
2022-12-02 13:55:51 -05:00

13 lines
388 B
Plaintext

INSERT INTO "OrganizationApiKey"(
"Id",
"OrganizationId",
"ApiKey",
"Type",
"RevisionDate")
SELECT uuid_in(overlay(overlay(md5(random()::text || ':' || random()::text) placing '4' from 13) placing to_hex(floor(random()*(11-8+1) + 8)::int)::text from 17)::cstring),
"Id" AS "OrganizationId",
"ApiKey",
0 AS "Type",
"RevisionDate"
FROM "Organization";