@authhero/drizzle 0.31.3 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -210,7 +210,7 @@ CREATE TABLE `refresh_tokens` (
210
210
  `id` text(21) NOT NULL,
211
211
  `tenant_id` text(191) NOT NULL,
212
212
  `client_id` text(191) NOT NULL,
213
- `session_id` text(21) NOT NULL,
213
+ `login_id` text(21) NOT NULL,
214
214
  `user_id` text(255),
215
215
  `resource_servers` text NOT NULL,
216
216
  `device` text NOT NULL,
@@ -224,7 +224,7 @@ CREATE TABLE `refresh_tokens` (
224
224
  );
225
225
  --> statement-breakpoint
226
226
  CREATE INDEX `idx_refresh_tokens_user_id` ON `refresh_tokens` (`tenant_id`,`user_id`);--> statement-breakpoint
227
- CREATE INDEX `idx_refresh_tokens_session_id` ON `refresh_tokens` (`session_id`);--> statement-breakpoint
227
+ CREATE INDEX `idx_refresh_tokens_login_id` ON `refresh_tokens` (`login_id`);--> statement-breakpoint
228
228
  CREATE INDEX `idx_refresh_tokens_expires_at_ts` ON `refresh_tokens` (`expires_at_ts`);--> statement-breakpoint
229
229
  CREATE TABLE `sessions` (
230
230
  `id` text(21) NOT NULL,
@@ -682,6 +682,27 @@ CREATE TABLE `universal_login_templates` (
682
682
  FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
683
683
  );
684
684
  --> statement-breakpoint
685
+ CREATE TABLE `authentication_methods` (
686
+ `id` text(26) PRIMARY KEY NOT NULL,
687
+ `tenant_id` text(191) NOT NULL,
688
+ `user_id` text(255) NOT NULL,
689
+ `type` text(32) NOT NULL,
690
+ `phone_number` text(32),
691
+ `totp_secret` text(255),
692
+ `credential_id` text(512),
693
+ `public_key` text,
694
+ `sign_count` integer,
695
+ `credential_backed_up` integer,
696
+ `transports` text(512),
697
+ `friendly_name` text(255),
698
+ `confirmed` integer DEFAULT 0 NOT NULL,
699
+ `created_at_ts` integer NOT NULL,
700
+ `updated_at_ts` integer NOT NULL,
701
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
702
+ );
703
+ --> statement-breakpoint
704
+ CREATE INDEX `authentication_methods_tenant_user_idx` ON `authentication_methods` (`tenant_id`,`user_id`);--> statement-breakpoint
705
+ CREATE INDEX `authentication_methods_credential_id_idx` ON `authentication_methods` (`credential_id`);--> statement-breakpoint
685
706
  CREATE TABLE `logs` (
686
707
  `log_id` text(21) PRIMARY KEY NOT NULL,
687
708
  `category` text(255),
@@ -717,4 +738,25 @@ CREATE TABLE `logs` (
717
738
  CREATE INDEX `logs_user_id` ON `logs` (`user_id`);--> statement-breakpoint
718
739
  CREATE INDEX `logs_tenant_id` ON `logs` (`tenant_id`);--> statement-breakpoint
719
740
  CREATE INDEX `logs_date` ON `logs` (`date`);--> statement-breakpoint
720
- CREATE INDEX `IDX_logs_tenant_date_type_user` ON `logs` (`tenant_id`,`date`,`type`,`user_id`);
741
+ CREATE INDEX `IDX_logs_tenant_date_type_user` ON `logs` (`tenant_id`,`date`,`type`,`user_id`);--> statement-breakpoint
742
+ CREATE TABLE `outbox_events` (
743
+ `id` text(26) PRIMARY KEY NOT NULL,
744
+ `tenant_id` text(191) NOT NULL,
745
+ `event_type` text(64) NOT NULL,
746
+ `log_type` text(64) NOT NULL,
747
+ `aggregate_type` text(64) NOT NULL,
748
+ `aggregate_id` text(255) NOT NULL,
749
+ `payload` text NOT NULL,
750
+ `created_at` text(35) NOT NULL,
751
+ `processed_at` text(35),
752
+ `retry_count` integer DEFAULT 0 NOT NULL,
753
+ `next_retry_at` text(35),
754
+ `error` text,
755
+ `claimed_by` text(255),
756
+ `claim_expires_at` text(35),
757
+ FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade
758
+ );
759
+ --> statement-breakpoint
760
+ CREATE INDEX `idx_outbox_events_tenant_id` ON `outbox_events` (`tenant_id`);--> statement-breakpoint
761
+ CREATE INDEX `idx_outbox_events_processed_at` ON `outbox_events` (`processed_at`);--> statement-breakpoint
762
+ CREATE INDEX `idx_outbox_events_claimed_by` ON `outbox_events` (`claimed_by`);
@@ -0,0 +1,9 @@
1
+ -- Remove duplicate domain rows, keeping one row per domain (the earliest inserted)
2
+ DELETE FROM `custom_domains`
3
+ WHERE rowid NOT IN (
4
+ SELECT MIN(rowid)
5
+ FROM `custom_domains`
6
+ GROUP BY `domain`
7
+ );
8
+
9
+ CREATE UNIQUE INDEX `custom_domains_domain_unique` ON `custom_domains` (`domain`);