Files
template-app/migrations/postgres/0006_app-user-identity.sql

37 lines
826 B
SQL

-- SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0
create table "app_user_identity" (
"id" uuid primary key,
"version" integer not null,
"created_at" timestamptz not null,
"updated_at" timestamptz not null,
"issuer" text not null,
"subject" text not null,
"user_id" uuid not null,
"migration_id" text
);
alter table "app_user_identity" add constraint "app_user_identity_issuer_subject_key" unique nulls not distinct ("issuer", "subject");
create index "app_user_identity_user_id_idx" on "app_user_identity" ("user_id");
insert into "app_user_identity" (
"id",
"version",
"created_at",
"updated_at",
"issuer",
"subject",
"user_id",
"migration_id"
)
select
"id",
1,
"created_at",
"updated_at",
"issuer",
"subject",
"id",
'legacy-users-issuer-subject-v1'
from "users";