@authhero/drizzle 0.56.3 → 0.58.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.
- package/dist/drizzle-adapter.cjs +7 -7
- package/dist/drizzle-adapter.mjs +7031 -6449
- package/drizzle/0000_init.sql +12 -3
- package/drizzle/0001_next_young_avengers.sql +15 -0
- package/drizzle/meta/0000_snapshot.json +85 -22
- package/drizzle/meta/0001_snapshot.json +6354 -0
- package/drizzle/meta/_journal.json +8 -1
- package/drizzle-control-plane/0000_tenant_operations.sql +47 -0
- package/drizzle-control-plane/meta/0000_snapshot.json +334 -0
- package/drizzle-control-plane/meta/_journal.json +13 -0
- package/package.json +5 -4
- package/src/schema/control-plane/index.ts +20 -0
- package/src/schema/control-plane/rollouts.ts +21 -0
- package/src/schema/control-plane/tenantOperations.ts +70 -0
- package/src/schema/sqlite/grants.ts +43 -0
- package/src/schema/sqlite/index.ts +2 -0
- package/src/schema/sqlite/userActivity.ts +38 -0
- package/src/schema/sqlite/users.ts +2 -3
package/drizzle/0000_init.sql
CHANGED
|
@@ -136,9 +136,6 @@ CREATE TABLE `users` (
|
|
|
136
136
|
`created_at` text(35) NOT NULL,
|
|
137
137
|
`updated_at` text(35) NOT NULL,
|
|
138
138
|
`linked_to` text(255),
|
|
139
|
-
`last_ip` text(255),
|
|
140
|
-
`login_count` integer NOT NULL,
|
|
141
|
-
`last_login` text(255),
|
|
142
139
|
`registration_completed_at` text(35),
|
|
143
140
|
`provider` text(255) NOT NULL,
|
|
144
141
|
`connection` text(255),
|
|
@@ -167,6 +164,18 @@ CREATE INDEX `users_email_index` ON `users` (`email`);--> statement-breakpoint
|
|
|
167
164
|
CREATE INDEX `users_linked_to_index` ON `users` (`linked_to`);--> statement-breakpoint
|
|
168
165
|
CREATE INDEX `users_name_index` ON `users` (`name`);--> statement-breakpoint
|
|
169
166
|
CREATE INDEX `users_phone_tenant_provider_index` ON `users` (`tenant_id`,`phone_number`,`provider`);--> statement-breakpoint
|
|
167
|
+
CREATE TABLE `user_activity` (
|
|
168
|
+
`tenant_id` text(255) NOT NULL,
|
|
169
|
+
`user_id` text(255) NOT NULL,
|
|
170
|
+
`last_login` text(35),
|
|
171
|
+
`last_ip` text(45),
|
|
172
|
+
`login_count` integer DEFAULT 0 NOT NULL,
|
|
173
|
+
`failed_logins` text,
|
|
174
|
+
`last_password_reset` text(35),
|
|
175
|
+
PRIMARY KEY(`tenant_id`, `user_id`),
|
|
176
|
+
FOREIGN KEY (`user_id`,`tenant_id`) REFERENCES `users`(`user_id`,`tenant_id`) ON UPDATE no action ON DELETE cascade
|
|
177
|
+
);
|
|
178
|
+
--> statement-breakpoint
|
|
170
179
|
CREATE TABLE `authentication_codes` (
|
|
171
180
|
`tenant_id` text(191) NOT NULL,
|
|
172
181
|
`code` text(255) PRIMARY KEY NOT NULL,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
CREATE TABLE `grants` (
|
|
2
|
+
`id` text(21) PRIMARY KEY NOT NULL,
|
|
3
|
+
`tenant_id` text(255) NOT NULL,
|
|
4
|
+
`user_id` text(255) NOT NULL,
|
|
5
|
+
`client_id` text(100) NOT NULL,
|
|
6
|
+
`audience` text(100) DEFAULT '' NOT NULL,
|
|
7
|
+
`scope` text DEFAULT '[]' NOT NULL,
|
|
8
|
+
`created_at` text(35) NOT NULL,
|
|
9
|
+
`updated_at` text(35) NOT NULL,
|
|
10
|
+
FOREIGN KEY (`tenant_id`) REFERENCES `tenants`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
11
|
+
FOREIGN KEY (`user_id`,`tenant_id`) REFERENCES `users`(`user_id`,`tenant_id`) ON UPDATE no action ON DELETE cascade
|
|
12
|
+
);
|
|
13
|
+
--> statement-breakpoint
|
|
14
|
+
CREATE UNIQUE INDEX `grants_natural_key_idx` ON `grants` (`tenant_id`,`user_id`,`client_id`,`audience`);--> statement-breakpoint
|
|
15
|
+
CREATE INDEX `grants_tenant_user_idx` ON `grants` (`tenant_id`,`user_id`);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "6",
|
|
3
3
|
"dialect": "sqlite",
|
|
4
|
-
"id": "
|
|
4
|
+
"id": "f5a5b35e-cf8e-4fe4-afe9-ec2d33b03c33",
|
|
5
5
|
"prevId": "00000000-0000-0000-0000-000000000000",
|
|
6
6
|
"tables": {
|
|
7
7
|
"tenants": {
|
|
@@ -952,27 +952,6 @@
|
|
|
952
952
|
"notNull": false,
|
|
953
953
|
"autoincrement": false
|
|
954
954
|
},
|
|
955
|
-
"last_ip": {
|
|
956
|
-
"name": "last_ip",
|
|
957
|
-
"type": "text(255)",
|
|
958
|
-
"primaryKey": false,
|
|
959
|
-
"notNull": false,
|
|
960
|
-
"autoincrement": false
|
|
961
|
-
},
|
|
962
|
-
"login_count": {
|
|
963
|
-
"name": "login_count",
|
|
964
|
-
"type": "integer",
|
|
965
|
-
"primaryKey": false,
|
|
966
|
-
"notNull": true,
|
|
967
|
-
"autoincrement": false
|
|
968
|
-
},
|
|
969
|
-
"last_login": {
|
|
970
|
-
"name": "last_login",
|
|
971
|
-
"type": "text(255)",
|
|
972
|
-
"primaryKey": false,
|
|
973
|
-
"notNull": false,
|
|
974
|
-
"autoincrement": false
|
|
975
|
-
},
|
|
976
955
|
"registration_completed_at": {
|
|
977
956
|
"name": "registration_completed_at",
|
|
978
957
|
"type": "text(35)",
|
|
@@ -1181,6 +1160,90 @@
|
|
|
1181
1160
|
"uniqueConstraints": {},
|
|
1182
1161
|
"checkConstraints": {}
|
|
1183
1162
|
},
|
|
1163
|
+
"user_activity": {
|
|
1164
|
+
"name": "user_activity",
|
|
1165
|
+
"columns": {
|
|
1166
|
+
"tenant_id": {
|
|
1167
|
+
"name": "tenant_id",
|
|
1168
|
+
"type": "text(255)",
|
|
1169
|
+
"primaryKey": false,
|
|
1170
|
+
"notNull": true,
|
|
1171
|
+
"autoincrement": false
|
|
1172
|
+
},
|
|
1173
|
+
"user_id": {
|
|
1174
|
+
"name": "user_id",
|
|
1175
|
+
"type": "text(255)",
|
|
1176
|
+
"primaryKey": false,
|
|
1177
|
+
"notNull": true,
|
|
1178
|
+
"autoincrement": false
|
|
1179
|
+
},
|
|
1180
|
+
"last_login": {
|
|
1181
|
+
"name": "last_login",
|
|
1182
|
+
"type": "text(35)",
|
|
1183
|
+
"primaryKey": false,
|
|
1184
|
+
"notNull": false,
|
|
1185
|
+
"autoincrement": false
|
|
1186
|
+
},
|
|
1187
|
+
"last_ip": {
|
|
1188
|
+
"name": "last_ip",
|
|
1189
|
+
"type": "text(45)",
|
|
1190
|
+
"primaryKey": false,
|
|
1191
|
+
"notNull": false,
|
|
1192
|
+
"autoincrement": false
|
|
1193
|
+
},
|
|
1194
|
+
"login_count": {
|
|
1195
|
+
"name": "login_count",
|
|
1196
|
+
"type": "integer",
|
|
1197
|
+
"primaryKey": false,
|
|
1198
|
+
"notNull": true,
|
|
1199
|
+
"autoincrement": false,
|
|
1200
|
+
"default": 0
|
|
1201
|
+
},
|
|
1202
|
+
"failed_logins": {
|
|
1203
|
+
"name": "failed_logins",
|
|
1204
|
+
"type": "text",
|
|
1205
|
+
"primaryKey": false,
|
|
1206
|
+
"notNull": false,
|
|
1207
|
+
"autoincrement": false
|
|
1208
|
+
},
|
|
1209
|
+
"last_password_reset": {
|
|
1210
|
+
"name": "last_password_reset",
|
|
1211
|
+
"type": "text(35)",
|
|
1212
|
+
"primaryKey": false,
|
|
1213
|
+
"notNull": false,
|
|
1214
|
+
"autoincrement": false
|
|
1215
|
+
}
|
|
1216
|
+
},
|
|
1217
|
+
"indexes": {},
|
|
1218
|
+
"foreignKeys": {
|
|
1219
|
+
"user_activity_user_id_constraint": {
|
|
1220
|
+
"name": "user_activity_user_id_constraint",
|
|
1221
|
+
"tableFrom": "user_activity",
|
|
1222
|
+
"tableTo": "users",
|
|
1223
|
+
"columnsFrom": [
|
|
1224
|
+
"user_id",
|
|
1225
|
+
"tenant_id"
|
|
1226
|
+
],
|
|
1227
|
+
"columnsTo": [
|
|
1228
|
+
"user_id",
|
|
1229
|
+
"tenant_id"
|
|
1230
|
+
],
|
|
1231
|
+
"onDelete": "cascade",
|
|
1232
|
+
"onUpdate": "no action"
|
|
1233
|
+
}
|
|
1234
|
+
},
|
|
1235
|
+
"compositePrimaryKeys": {
|
|
1236
|
+
"user_activity_pkey": {
|
|
1237
|
+
"columns": [
|
|
1238
|
+
"tenant_id",
|
|
1239
|
+
"user_id"
|
|
1240
|
+
],
|
|
1241
|
+
"name": "user_activity_pkey"
|
|
1242
|
+
}
|
|
1243
|
+
},
|
|
1244
|
+
"uniqueConstraints": {},
|
|
1245
|
+
"checkConstraints": {}
|
|
1246
|
+
},
|
|
1184
1247
|
"authentication_codes": {
|
|
1185
1248
|
"name": "authentication_codes",
|
|
1186
1249
|
"columns": {
|