feat: cleanup tables (#14203)

#### PR Dependency Tree


* **PR #14203** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Chores**
* Removed deprecated database tables, enums and schema fields (cleanup
of legacy subscription, invoice, runtime settings and session expiry
data). This includes irreversible data removal for those legacy
elements.
* **Tests**
* Updated tests and test data to align with the cleaned-up schema and
removed fields.

<sub>✏️ Tip: You can customize this high-level summary in your review
settings.</sub>
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
DarkSky
2026-01-03 03:50:14 +08:00
committed by GitHub
parent 41addfe311
commit 3633c75c6f
10 changed files with 59 additions and 173 deletions

View File

@@ -41,7 +41,6 @@ const snapshot: Snapshot = {
id: 'doc1',
blob: Uint8Array.from([1, 0]),
state: Uint8Array.from([0]),
seq: 0,
size: BigInt(2),
updatedAt: new Date(),
createdAt: new Date(),

View File

@@ -38,7 +38,6 @@ test('should create a new session', async t => {
const session = await t.context.session.createSession();
t.truthy(session.id);
t.truthy(session.createdAt);
t.is(session.deprecated_expiresAt, null);
});
test('should get a exists session', async t => {

View File

@@ -16,7 +16,6 @@ export class WorkspaceResolverMock {
create: {
type: WorkspaceRole.Owner,
userId: user.id,
accepted: true,
status: WorkspaceMemberStatus.Accepted,
},
},

View File

@@ -1,18 +0,0 @@
import { PrismaClient, WorkspaceMemberStatus } from '@prisma/client';
export class MigrateInviteStatus1732861452428 {
// do the migration
static async up(db: PrismaClient) {
await db.workspaceUserRole.updateMany({
where: {
accepted: true,
},
data: {
status: WorkspaceMemberStatus.Accepted,
},
});
}
// revert the migration
static async down(_db: PrismaClient) {}
}

View File

@@ -1,29 +0,0 @@
import { PrismaClient } from '@prisma/client';
import { loop } from './utils/loop';
export class UniversalSubscription1733125339942 {
// do the migration
static async up(db: PrismaClient) {
await loop(async (offset, take) => {
const oldSubscriptions = await db.deprecatedUserSubscription.findMany({
skip: offset,
take,
});
await db.subscription.createMany({
data: oldSubscriptions.map(({ userId, ...subscription }) => ({
targetId: userId,
...subscription,
})),
});
return oldSubscriptions.length;
}, 50);
}
// revert the migration
static async down(_db: PrismaClient) {
// noop
}
}

View File

@@ -1,7 +1,5 @@
export * from './1698398506533-guid';
export * from './1703756315970-unamed-account';
export * from './1721299086340-refresh-unnamed-user';
export * from './1732861452428-migrate-invite-status';
export * from './1733125339942-universal-subscription';
export * from './1745211351719-create-indexer-tables';
export * from './1751966744168-correct-session-update-time';

View File

@@ -61,7 +61,6 @@ export class DocModel extends BaseModel {
blob: record.blob,
createdAt: new Date(record.timestamp),
createdBy: record.editorId || null,
seq: null,
};
}