37 lines
877 B
SQL
37 lines
877 B
SQL
-- SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0
|
|
create table `app_user_identity` (
|
|
`id` char(36) primary key,
|
|
`version` integer not null,
|
|
`created_at` datetime(6) not null,
|
|
`updated_at` datetime(6) not null,
|
|
`issuer` varchar(255) not null,
|
|
`subject` varchar(255) not null,
|
|
`user_id` char(36) not null,
|
|
`migration_id` varchar(255)
|
|
) engine=InnoDB default charset=utf8mb4;
|
|
|
|
alter table `app_user_identity` add constraint `app_user_identity_issuer_subject_key` unique (`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`;
|