@meith/db 0.32.0 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@meith/db",
3
- "version": "0.32.0",
3
+ "version": "0.33.0",
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.32.0",
26
- "@meith/admin": "0.32.0",
27
- "@meith/antispam": "0.32.0",
28
- "@meith/api": "0.32.0",
29
- "@meith/attachments": "0.32.0",
30
- "@meith/authorization": "0.32.0",
31
- "@meith/avatars": "0.32.0",
32
- "@meith/board-digest": "0.32.0",
33
- "@meith/core": "0.32.0",
34
- "@meith/drafts": "0.32.0",
35
- "@meith/events": "0.32.0",
36
- "@meith/forums": "0.32.0",
37
- "@meith/groups": "0.32.0",
38
- "@meith/i18n": "0.32.0",
39
- "@meith/markdown": "0.32.0",
40
- "@meith/marketplace": "0.32.0",
41
- "@meith/messages": "0.32.0",
42
- "@meith/moderation": "0.32.0",
43
- "@meith/notifications": "0.32.0",
44
- "@meith/plugin-kit": "0.32.0",
45
- "@meith/polls": "0.32.0",
46
- "@meith/profile-fields": "0.32.0",
47
- "@meith/relations": "0.32.0",
48
- "@meith/reputation": "0.32.0",
49
- "@meith/search": "0.32.0",
50
- "@meith/settings": "0.32.0",
51
- "@meith/signatures": "0.32.0",
52
- "@meith/subscriptions": "0.32.0",
53
- "@meith/tasks": "0.32.0",
54
- "@meith/threads": "0.32.0"
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"
55
55
  },
56
56
  "devDependencies": {
57
57
  "drizzle-kit": "^0.31.6",
@@ -14,22 +14,25 @@ export interface PluginPurgeResult {
14
14
  readonly healthRemoved: boolean
15
15
  }
16
16
 
17
+ const CORE_TABLES: ReadonlySet<string> = new Set(['plugin_migrations', 'plugin_health'])
18
+
17
19
  export async function pluginOwnedTables(
18
20
  db: Database,
19
21
  pluginKey: string,
20
22
  ): Promise<readonly string[]> {
23
+ const prefix = pluginTablePrefix(pluginKey)
21
24
  const rows = resultRows(
22
25
  await db.execute(sql`
23
26
  select table_name
24
27
  from information_schema.tables
25
28
  where table_schema = 'public'
26
29
  and table_type = 'BASE TABLE'
27
- and table_name like ${`${pluginTablePrefix(pluginKey)}%`}
30
+ and starts_with(table_name::text, ${prefix})
28
31
  order by table_name
29
32
  `),
30
33
  ) as Array<{ table_name: string }>
31
34
 
32
- return rows.map((row) => String(row.table_name))
35
+ return rows.map((row) => String(row.table_name)).filter((name) => !CORE_TABLES.has(name))
33
36
  }
34
37
 
35
38
  export async function purgePlugin(db: Database, pluginKey: string): Promise<PluginPurgeResult> {