@drizzle-adapter/d1 1.0.5 → 1.0.6
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/.wrangler/state/v3/d1/miniflare-D1DatabaseObject/6e148680931b1bfcb993e0463aced3b0a6d6cf50af24dea2dcc2c3b2e9ae9e3b.sqlite-shm +0 -0
- package/.wrangler/state/v3/d1/miniflare-D1DatabaseObject/6e148680931b1bfcb993e0463aced3b0a6d6cf50af24dea2dcc2c3b2e9ae9e3b.sqlite-wal +0 -0
- package/.wrangler/tmp/bundle-6mwcNF/checked-fetch.js +30 -0
- package/.wrangler/tmp/bundle-6mwcNF/middleware-insertion-facade.js +11 -0
- package/.wrangler/tmp/bundle-6mwcNF/middleware-loader.entry.ts +134 -0
- package/.wrangler/tmp/bundle-hcIiZ8/checked-fetch.js +30 -0
- package/.wrangler/tmp/bundle-hcIiZ8/middleware-insertion-facade.js +11 -0
- package/.wrangler/tmp/bundle-hcIiZ8/middleware-loader.entry.ts +134 -0
- package/.wrangler/tmp/dev-Zv3JSE/worker.js +6094 -0
- package/.wrangler/tmp/dev-Zv3JSE/worker.js.map +8 -0
- package/.wrangler/tmp/dev-aPPB6u/worker.js +6498 -0
- package/.wrangler/tmp/dev-aPPB6u/worker.js.map +8 -0
- package/dist/Adapter/D1DrizzleMigrator.js +1 -1
- package/dist/Adapter/index.d.ts +0 -1
- package/dist/Adapter/index.js +0 -1
- package/dist/Factory/D1DrizzleMigratorFactory.d.ts +1 -1
- package/dist/Factory/D1DrizzleMigratorFactory.js +1 -1
- package/dist/Factory/index.d.ts +0 -1
- package/dist/Factory/index.js +0 -1
- package/dist/index.js +2 -2
- package/dist/migrator.d.ts +4 -0
- package/dist/migrator.js +7 -0
- package/package.json +1 -1
- package/src/Adapter/D1DrizzleMigrator.ts +1 -1
- package/src/Adapter/index.ts +0 -1
- package/src/Factory/D1DrizzleMigratorFactory.ts +1 -1
- package/src/Factory/index.ts +0 -1
- package/src/index.ts +2 -2
- package/src/migrator.ts +9 -0
- package/tests/Factory/D1DrizzleMigratorFactory.test.ts +2 -2
- package/tsconfig.json +1 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { DrizzleD1Database } from 'drizzle-orm/d1/driver';
|
|
2
|
-
import { migrate } from 'drizzle-orm/d1/migrator';
|
|
3
2
|
export class D1DrizzleMigrator {
|
|
4
3
|
config;
|
|
5
4
|
/**
|
|
@@ -16,6 +15,7 @@ export class D1DrizzleMigrator {
|
|
|
16
15
|
* @param {DrizzleClientInterface} client The Drizzle client.
|
|
17
16
|
*/
|
|
18
17
|
async migrate(client) {
|
|
18
|
+
const { migrate } = await import('drizzle-orm/d1/migrator');
|
|
19
19
|
await migrate(client, {
|
|
20
20
|
migrationsFolder: this.config.DATABASE_MIGRATIONS_FOLDER,
|
|
21
21
|
migrationsTable: this.config.DATABASE_MIGRATIONS_TABLE,
|
package/dist/Adapter/index.d.ts
CHANGED
package/dist/Adapter/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DrizzleMigratorFactoryInterface, TypeDrizzleMigratorConfig } from '@drizzle-adapter/core';
|
|
2
|
-
import { D1DrizzleMigrator } from '../
|
|
2
|
+
import { D1DrizzleMigrator } from '../migrator.js';
|
|
3
3
|
export declare class D1DrizzleMigratorFactory implements DrizzleMigratorFactoryInterface {
|
|
4
4
|
/**
|
|
5
5
|
* Returns a new migrator.
|
package/dist/Factory/index.d.ts
CHANGED
package/dist/Factory/index.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ export * from './Factory/index.js';
|
|
|
3
3
|
export * from './Interface/index.js';
|
|
4
4
|
export * from './Type/index.js';
|
|
5
5
|
// default export so that core factory can use it directly
|
|
6
|
-
import { D1DrizzleAdapterFactory
|
|
6
|
+
import { D1DrizzleAdapterFactory } from './Factory/index.js';
|
|
7
7
|
export default D1DrizzleAdapterFactory;
|
|
8
8
|
import { DrizzleAdapterFactoryRegistry } from '@drizzle-adapter/core';
|
|
9
|
-
DrizzleAdapterFactoryRegistry.
|
|
9
|
+
DrizzleAdapterFactoryRegistry.registerAdapterFactory('d1', D1DrizzleAdapterFactory);
|
package/dist/migrator.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './Adapter/D1DrizzleMigrator.js';
|
|
2
|
+
export * from './Factory/D1DrizzleMigratorFactory.js';
|
|
3
|
+
// default export so that core factory can use it directly
|
|
4
|
+
import { D1DrizzleMigratorFactory } from './Factory/D1DrizzleMigratorFactory.js';
|
|
5
|
+
export default D1DrizzleMigratorFactory;
|
|
6
|
+
import { DrizzleMigratorFactoryRegistry } from '@drizzle-adapter/core/migrator';
|
|
7
|
+
DrizzleMigratorFactoryRegistry.registerMigratorFactory('d1', D1DrizzleMigratorFactory);
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { DrizzleMigratorInterface, TypeDrizzleMigratorConfig } from '@drizzle-adapter/core';
|
|
2
2
|
import { DrizzleD1Database } from 'drizzle-orm/d1/driver';
|
|
3
|
-
import { migrate } from 'drizzle-orm/d1/migrator';
|
|
4
3
|
import type { D1DrizzleClientInterface } from '../Interface';
|
|
5
4
|
|
|
6
5
|
export class D1DrizzleMigrator implements DrizzleMigratorInterface
|
|
@@ -19,6 +18,7 @@ export class D1DrizzleMigrator implements DrizzleMigratorInterface
|
|
|
19
18
|
*/
|
|
20
19
|
public async migrate(client: D1DrizzleClientInterface): Promise<void>
|
|
21
20
|
{
|
|
21
|
+
const { migrate } = await import('drizzle-orm/d1/migrator');
|
|
22
22
|
await migrate(client as unknown as DrizzleD1Database<Record<string, unknown>>, {
|
|
23
23
|
migrationsFolder: this.config.DATABASE_MIGRATIONS_FOLDER,
|
|
24
24
|
migrationsTable: this.config.DATABASE_MIGRATIONS_TABLE,
|
package/src/Adapter/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DrizzleMigratorFactoryInterface, TypeDrizzleMigratorConfig } from '@drizzle-adapter/core';
|
|
2
|
-
import { D1DrizzleMigrator } from '../
|
|
2
|
+
import { D1DrizzleMigrator } from '../migrator';
|
|
3
3
|
|
|
4
4
|
export class D1DrizzleMigratorFactory implements DrizzleMigratorFactoryInterface
|
|
5
5
|
{
|
package/src/Factory/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -4,8 +4,8 @@ export * from './Interface';
|
|
|
4
4
|
export * from './Type';
|
|
5
5
|
|
|
6
6
|
// default export so that core factory can use it directly
|
|
7
|
-
import { D1DrizzleAdapterFactory
|
|
7
|
+
import { D1DrizzleAdapterFactory } from './Factory';
|
|
8
8
|
export default D1DrizzleAdapterFactory;
|
|
9
9
|
|
|
10
10
|
import { DrizzleAdapterFactoryRegistry } from '@drizzle-adapter/core';
|
|
11
|
-
DrizzleAdapterFactoryRegistry.
|
|
11
|
+
DrizzleAdapterFactoryRegistry.registerAdapterFactory('d1', D1DrizzleAdapterFactory);
|
package/src/migrator.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './Adapter/D1DrizzleMigrator';
|
|
2
|
+
export * from './Factory/D1DrizzleMigratorFactory';
|
|
3
|
+
|
|
4
|
+
// default export so that core factory can use it directly
|
|
5
|
+
import { D1DrizzleMigratorFactory } from './Factory/D1DrizzleMigratorFactory';
|
|
6
|
+
export default D1DrizzleMigratorFactory;
|
|
7
|
+
|
|
8
|
+
import { DrizzleMigratorFactoryRegistry } from '@drizzle-adapter/core/migrator';
|
|
9
|
+
DrizzleMigratorFactoryRegistry.registerMigratorFactory('d1', D1DrizzleMigratorFactory);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { D1DrizzleMigratorFactory } from '../../src/Factory';
|
|
3
|
-
import { D1DrizzleMigrator } from '../../src/Adapter';
|
|
2
|
+
import { D1DrizzleMigratorFactory } from '../../src/Factory/D1DrizzleMigratorFactory';
|
|
3
|
+
import { D1DrizzleMigrator } from '../../src/Adapter/D1DrizzleMigrator';
|
|
4
4
|
import type { TypeDrizzleMigratorConfig } from '@drizzle-adapter/core';
|
|
5
5
|
|
|
6
6
|
describe('D1DrizzleMigratorFactory', () => {
|