| 306 | } |
| 307 | |
| 308 | const createTables = chunks.find(chunk => |
| 309 | chunk.includes('CREATE TABLE "anthropic_user_profile_cleanup_state"') |
| 310 | ); |
| 311 | expect(createTables).not.toContain('ALTER TABLE'); |
| 312 | }); |
| 313 | |
| 314 | it('migration 0384 keeps insert-triggered autovacuum frequent on microdollar_usage', async () => { |
| 315 | const result = await schemaTestDb.db.execute<{ reloptions: string[] | null }>(sql` |
| 316 | SELECT reloptions FROM pg_class WHERE oid = to_regclass('public.microdollar_usage') |
| 317 | `); |
| 318 | expect(result.rows[0]?.reloptions).toEqual( |
| 319 | expect.arrayContaining([ |
| 320 | 'autovacuum_vacuum_insert_scale_factor=0', |
| 321 | 'autovacuum_vacuum_insert_threshold=500000', |
| 322 | ]) |
| 323 | ); |
| 324 | }); |
| 325 | |
| 326 | it('migration 0345 backfills old owners and folders to activity and copies built-in agent overrides', async () => { |
| 327 | const migration = fs.readFileSync( |
| 328 | path.join(__dirname, 'migrations/0345_cloud_agent_stacked_workspaces.sql'), |
| 329 | 'utf8' |
| 330 | ); |
| 331 | const backfills = migration |
| 332 | .split('--> statement-breakpoint') |
| 333 | .slice(1) |
| 334 | .map(statement => statement.trim()); |
| 335 | expect(backfills).toHaveLength(3); |
| 336 | expect(backfills[0]).toContain('INSERT INTO "cloud_agent_user_settings"'); |
| 337 | expect(backfills[1]).toContain('FROM "cloud_agent_builtin_agent_settings"'); |