@boxxy/store-sqlite 0.1.1 → 0.1.3
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/README.md +8 -6
- package/dist/codecs/parse-json-text.d.ts +1 -0
- package/dist/constants.d.ts +1 -0
- package/dist/migrations/rename-relations-migration.d.ts +2 -0
- package/dist/{run-store-migrations.d.ts → migrations/run-store-migrations.d.ts} +1 -1
- package/dist/migrations/v1-tables-migration.d.ts +2 -0
- package/dist/{build-sqlite-reader.d.ts → reads/build-sqlite-reader.d.ts} +1 -1
- package/dist/reads/is-latest-of-session.d.ts +3 -0
- package/dist/{read-item-views.d.ts → reads/read-item-views.d.ts} +3 -3
- package/dist/reads/read-limit-fills.d.ts +4 -0
- package/dist/reads/read-wakes.d.ts +4 -0
- package/dist/test-utils/create-claim-bench.d.ts +8 -0
- package/dist/types.d.ts +60 -10
- package/dist/with-busy-retry.d.ts +1 -0
- package/dist/with-transaction.d.ts +3 -0
- package/dist/{apply-sqlite-change.d.ts → writes/apply-sqlite-change.d.ts} +1 -1
- package/dist/{create-sqlite-tx.d.ts → writes/create-sqlite-tx.d.ts} +1 -1
- package/dist/writes/take-write-lock.d.ts +3 -0
- package/package.json +7 -5
- package/src/codecs/parse-json-text.ts +5 -0
- package/src/{table-codecs.ts → codecs/table-codecs.ts} +52 -15
- package/src/constants.ts +1 -0
- package/src/create-sqlite-claim-store.ts +73 -51
- package/src/migrations/rename-relations-migration.ts +17 -0
- package/src/migrations/run-store-migrations.ts +42 -0
- package/src/migrations/v1-tables-migration.ts +184 -0
- package/src/reads/build-sqlite-reader.ts +484 -0
- package/src/reads/is-latest-of-session.ts +21 -0
- package/src/{read-item-views.ts → reads/read-item-views.ts} +9 -9
- package/src/reads/read-limit-fills.ts +32 -0
- package/src/reads/read-wakes.ts +34 -0
- package/src/test-utils/create-claim-bench.ts +66 -0
- package/src/test-utils/create-test-claim-store.ts +2 -1
- package/src/types.ts +60 -10
- package/src/with-busy-retry.ts +32 -0
- package/src/with-transaction.ts +29 -0
- package/src/{apply-sqlite-change.ts → writes/apply-sqlite-change.ts} +77 -74
- package/src/writes/create-sqlite-tx.ts +229 -0
- package/src/writes/take-write-lock.ts +8 -0
- package/src/build-sqlite-reader.ts +0 -321
- package/src/create-sqlite-tx.ts +0 -134
- package/src/run-store-migrations.ts +0 -20
- /package/dist/{parse-store-row.d.ts → codecs/parse-store-row.d.ts} +0 -0
- /package/dist/{table-codecs.d.ts → codecs/table-codecs.d.ts} +0 -0
- /package/dist/{to-column-name.d.ts → codecs/to-column-name.d.ts} +0 -0
- /package/dist/{to-store-columns.d.ts → codecs/to-store-columns.d.ts} +0 -0
- /package/dist/{create-tables-migration.d.ts → migrations/create-tables-migration.d.ts} +0 -0
- /package/src/{parse-store-row.ts → codecs/parse-store-row.ts} +0 -0
- /package/src/{to-column-name.ts → codecs/to-column-name.ts} +0 -0
- /package/src/{to-store-columns.ts → codecs/to-store-columns.ts} +0 -0
- /package/src/{create-tables-migration.ts → migrations/create-tables-migration.ts} +0 -0
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { Kysely } from 'kysely';
|
|
2
|
-
import { Migrator } from 'kysely/migration';
|
|
3
|
-
import { createTablesMigration } from './create-tables-migration.ts';
|
|
4
|
-
import type { StoreDatabase } from './types.ts';
|
|
5
|
-
|
|
6
|
-
// Kysely runs the migrations in the order of their names, and skips each one the file has run.
|
|
7
|
-
const migrations = { '0001-create-tables': createTablesMigration };
|
|
8
|
-
|
|
9
|
-
export async function runStoreMigrations(db: Kysely<StoreDatabase>): Promise<void> {
|
|
10
|
-
const migrator = new Migrator({
|
|
11
|
-
db,
|
|
12
|
-
provider: { getMigrations: () => Promise.resolve(migrations) },
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
const outcome = await migrator.migrateToLatest();
|
|
16
|
-
|
|
17
|
-
if (outcome.error !== undefined) {
|
|
18
|
-
throw new Error('the store migrations failed', { cause: outcome.error });
|
|
19
|
-
}
|
|
20
|
-
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|