summaryrefslogtreecommitdiffhomepage
path: root/packages/storage-sqlite/src/migrate.ts
blob: bdd32b82d30825a8b4488e1abb2438ee848ea3a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
export interface Migration {
	readonly version: number;
	readonly name: string;
	readonly up: string;
}

export function computePending(
	appliedVersions: ReadonlySet<number>,
	migrations: readonly Migration[],
): readonly Migration[] {
	return migrations
		.filter((m) => !appliedVersions.has(m.version))
		.sort((a, b) => a.version - b.version);
}