@meith/db 0.33.0 → 0.33.1

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.
@@ -463,6 +463,13 @@
463
463
  "when": 1788346593870,
464
464
  "tag": "0065_serious_puff_adder",
465
465
  "breakpoints": true
466
+ },
467
+ {
468
+ "idx": 66,
469
+ "version": "7",
470
+ "when": 1788367778886,
471
+ "tag": "0066_board_digest_due_index",
472
+ "breakpoints": true
466
473
  }
467
474
  ]
468
475
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meith/db",
3
- "version": "0.33.0",
3
+ "version": "0.33.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,36 +22,36 @@
22
22
  "dependencies": {
23
23
  "drizzle-orm": "^0.45.2",
24
24
  "postgres": "^3.4.7",
25
- "@meith/accounts": "0.33.0",
26
- "@meith/admin": "0.33.0",
27
- "@meith/antispam": "0.33.0",
28
- "@meith/api": "0.33.0",
29
- "@meith/attachments": "0.33.0",
30
- "@meith/authorization": "0.33.0",
31
- "@meith/avatars": "0.33.0",
32
- "@meith/board-digest": "0.33.0",
33
- "@meith/core": "0.33.0",
34
- "@meith/drafts": "0.33.0",
35
- "@meith/events": "0.33.0",
36
- "@meith/forums": "0.33.0",
37
- "@meith/groups": "0.33.0",
38
- "@meith/i18n": "0.33.0",
39
- "@meith/markdown": "0.33.0",
40
- "@meith/marketplace": "0.33.0",
41
- "@meith/messages": "0.33.0",
42
- "@meith/moderation": "0.33.0",
43
- "@meith/notifications": "0.33.0",
44
- "@meith/plugin-kit": "0.33.0",
45
- "@meith/polls": "0.33.0",
46
- "@meith/profile-fields": "0.33.0",
47
- "@meith/relations": "0.33.0",
48
- "@meith/reputation": "0.33.0",
49
- "@meith/search": "0.33.0",
50
- "@meith/settings": "0.33.0",
51
- "@meith/signatures": "0.33.0",
52
- "@meith/subscriptions": "0.33.0",
53
- "@meith/tasks": "0.33.0",
54
- "@meith/threads": "0.33.0"
25
+ "@meith/accounts": "0.33.1",
26
+ "@meith/admin": "0.33.1",
27
+ "@meith/antispam": "0.33.1",
28
+ "@meith/api": "0.33.1",
29
+ "@meith/attachments": "0.33.1",
30
+ "@meith/authorization": "0.33.1",
31
+ "@meith/avatars": "0.33.1",
32
+ "@meith/board-digest": "0.33.1",
33
+ "@meith/core": "0.33.1",
34
+ "@meith/drafts": "0.33.1",
35
+ "@meith/events": "0.33.1",
36
+ "@meith/forums": "0.33.1",
37
+ "@meith/groups": "0.33.1",
38
+ "@meith/i18n": "0.33.1",
39
+ "@meith/markdown": "0.33.1",
40
+ "@meith/marketplace": "0.33.1",
41
+ "@meith/messages": "0.33.1",
42
+ "@meith/moderation": "0.33.1",
43
+ "@meith/notifications": "0.33.1",
44
+ "@meith/plugin-kit": "0.33.1",
45
+ "@meith/polls": "0.33.1",
46
+ "@meith/profile-fields": "0.33.1",
47
+ "@meith/relations": "0.33.1",
48
+ "@meith/reputation": "0.33.1",
49
+ "@meith/search": "0.33.1",
50
+ "@meith/settings": "0.33.1",
51
+ "@meith/signatures": "0.33.1",
52
+ "@meith/subscriptions": "0.33.1",
53
+ "@meith/tasks": "0.33.1",
54
+ "@meith/threads": "0.33.1"
55
55
  },
56
56
  "devDependencies": {
57
57
  "drizzle-kit": "^0.31.6",
@@ -149,6 +149,9 @@ export const users = pgTable(
149
149
  .on(t.signatureRenderVersion, t.id)
150
150
  .where(sql`${t.signature} <> ''`),
151
151
  index('users_mass_mail_opt_in_idx').on(t.id).where(sql`${t.massMailOptInAt} is not null`),
152
+ index('users_board_digest_due_idx')
153
+ .on(t.boardDigestCadence, t.lastActiveAt)
154
+ .where(sql`${t.state} = 'active'`),
152
155
  ],
153
156
  )
154
157
 
@@ -1,5 +1,6 @@
1
1
  import { sql } from 'drizzle-orm'
2
2
 
3
+ import { MYBB_PREFIX, PHPBB_PREFIX } from '@meith/accounts'
3
4
  import type { TaskHealthInput } from '@meith/tasks'
4
5
 
5
6
  import type { Database } from './client'
@@ -116,6 +117,20 @@ export class PostgresSystemHealthRepository {
116
117
  }
117
118
  }
118
119
 
120
+ async legacyPasswordHashes(): Promise<number> {
121
+ const rows = resultRows(
122
+ await this.db.execute(sql`
123
+ select count(*)::int as count
124
+ from users
125
+ where deleted_at is null
126
+ and (password_hash like ${`${MYBB_PREFIX}%`}
127
+ or password_hash like ${`${PHPBB_PREFIX}%`})
128
+ `),
129
+ ) as Array<Record<string, unknown>>
130
+
131
+ return Number(rows[0]?.count ?? 0)
132
+ }
133
+
119
134
  async activeConnections(): Promise<number> {
120
135
  const rows = resultRows(
121
136
  await this.db.execute(sql`