@magnet-cms/adapter-db-drizzle 1.0.2 → 3.0.0
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/dist/index.cjs +10572 -10499
- package/dist/index.d.cts +14 -1
- package/dist/index.d.ts +14 -1
- package/dist/index.js +290 -218
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -433,11 +433,14 @@ declare class DrizzleDatabaseAdapter extends DatabaseAdapter {
|
|
|
433
433
|
private options;
|
|
434
434
|
private schemaRegistry;
|
|
435
435
|
private tablesInitialized;
|
|
436
|
+
private tablesInitPromise;
|
|
436
437
|
/**
|
|
437
438
|
* Automatically create tables for all registered schemas.
|
|
438
439
|
* Called lazily when first model is accessed, or can be called explicitly.
|
|
440
|
+
* Uses a lock (Promise) to prevent concurrent execution from multiple forFeature() calls.
|
|
439
441
|
*/
|
|
440
442
|
ensureTablesCreated(): Promise<void>;
|
|
443
|
+
private _doEnsureTablesCreated;
|
|
441
444
|
/**
|
|
442
445
|
* Run the auto-migration system when `config.migrations` is configured.
|
|
443
446
|
*/
|
|
@@ -455,6 +458,11 @@ declare class DrizzleDatabaseAdapter extends DatabaseAdapter {
|
|
|
455
458
|
* Generate and execute CREATE TABLE IF NOT EXISTS statement from table config.
|
|
456
459
|
*/
|
|
457
460
|
private createTableFromConfig;
|
|
461
|
+
/**
|
|
462
|
+
* Execute raw SQL across all supported dialects.
|
|
463
|
+
* PostgreSQL/MySQL use db.execute(), SQLite uses db.run().
|
|
464
|
+
*/
|
|
465
|
+
private execRawSQL;
|
|
458
466
|
/**
|
|
459
467
|
* Map PostgreSQL SQL types to dialect-specific types.
|
|
460
468
|
*/
|
|
@@ -763,6 +771,11 @@ declare class MigrationRunner {
|
|
|
763
771
|
}>;
|
|
764
772
|
}
|
|
765
773
|
|
|
774
|
+
/**
|
|
775
|
+
* drizzle-kit emits partial unique-index WHERE clauses with `$1`/`$2` placeholders,
|
|
776
|
+
* but Magnet runs DDL as plain strings without bound parameters.
|
|
777
|
+
*/
|
|
778
|
+
declare function sanitizeExecutableMigrationSql(dialect: MigrationDialect, statement: string): string;
|
|
766
779
|
/**
|
|
767
780
|
* Default filename for persisted schema snapshot (used by auto-migration).
|
|
768
781
|
*/
|
|
@@ -1056,4 +1069,4 @@ declare class AutoMigration {
|
|
|
1056
1069
|
run(dialect: MigrationDialect, config: MigrationConfig, directory: string): Promise<void>;
|
|
1057
1070
|
}
|
|
1058
1071
|
|
|
1059
|
-
export { Adapter, AutoMigration, type ColumnChange, DEFAULT_LOCALE, DEFAULT_MIGRATION_CONFIG, DOCUMENT_STATUS, DRIZZLE_CONFIG, DRIZZLE_DB, type DiffResult, type DocumentColumnOptions, type DocumentStatus, type DrizzleConfig, type DrizzleDB, DrizzleDatabaseAdapter, type DrizzleModuleOptions, DrizzleQueryBuilder, type GenerateJsonFn, type GenerateSQLFn, type GeneratedSchema, type IndexChange, InjectModel, LazyQueryBuilder, type Migration, MigrationChecksumError, type MigrationConfig, type MigrationDb, type MigrationDialect, MigrationError, type MigrationGenerateOptions, MigrationGenerator, MigrationHistory, type MigrationHistoryRecord, MigrationLock, MigrationLockError, type MigrationMode, type MigrationResult, MigrationRunner, Prop, type PropMetadata, SNAPSHOT_FILENAME, Schema, SchemaBridge, SchemaDiff, type SchemaDiffResult, type SchemaMetadata, type SnapshotJSON, type TableDefinition, applyDocumentColumns, clearSchemaRegistry, createNeonConnection, createNeonWebSocketConnection, generateSchema, getDrizzleModelToken, getDrizzlePropsMetadata, getDrizzleSchemaMetadata, getOrGenerateSchema, getRegisteredSchemas, isDraft, isPublished, index as sqlGenerators };
|
|
1072
|
+
export { Adapter, AutoMigration, type ColumnChange, DEFAULT_LOCALE, DEFAULT_MIGRATION_CONFIG, DOCUMENT_STATUS, DRIZZLE_CONFIG, DRIZZLE_DB, type DiffResult, type DocumentColumnOptions, type DocumentStatus, type DrizzleConfig, type DrizzleDB, DrizzleDatabaseAdapter, type DrizzleModuleOptions, DrizzleQueryBuilder, type GenerateJsonFn, type GenerateSQLFn, type GeneratedSchema, type IndexChange, InjectModel, LazyQueryBuilder, type Migration, MigrationChecksumError, type MigrationConfig, type MigrationDb, type MigrationDialect, MigrationError, type MigrationGenerateOptions, MigrationGenerator, MigrationHistory, type MigrationHistoryRecord, MigrationLock, MigrationLockError, type MigrationMode, type MigrationResult, MigrationRunner, Prop, type PropMetadata, SNAPSHOT_FILENAME, Schema, SchemaBridge, SchemaDiff, type SchemaDiffResult, type SchemaMetadata, type SnapshotJSON, type TableDefinition, applyDocumentColumns, clearSchemaRegistry, createNeonConnection, createNeonWebSocketConnection, generateSchema, getDrizzleModelToken, getDrizzlePropsMetadata, getDrizzleSchemaMetadata, getOrGenerateSchema, getRegisteredSchemas, isDraft, isPublished, sanitizeExecutableMigrationSql, index as sqlGenerators };
|
package/dist/index.d.ts
CHANGED
|
@@ -433,11 +433,14 @@ declare class DrizzleDatabaseAdapter extends DatabaseAdapter {
|
|
|
433
433
|
private options;
|
|
434
434
|
private schemaRegistry;
|
|
435
435
|
private tablesInitialized;
|
|
436
|
+
private tablesInitPromise;
|
|
436
437
|
/**
|
|
437
438
|
* Automatically create tables for all registered schemas.
|
|
438
439
|
* Called lazily when first model is accessed, or can be called explicitly.
|
|
440
|
+
* Uses a lock (Promise) to prevent concurrent execution from multiple forFeature() calls.
|
|
439
441
|
*/
|
|
440
442
|
ensureTablesCreated(): Promise<void>;
|
|
443
|
+
private _doEnsureTablesCreated;
|
|
441
444
|
/**
|
|
442
445
|
* Run the auto-migration system when `config.migrations` is configured.
|
|
443
446
|
*/
|
|
@@ -455,6 +458,11 @@ declare class DrizzleDatabaseAdapter extends DatabaseAdapter {
|
|
|
455
458
|
* Generate and execute CREATE TABLE IF NOT EXISTS statement from table config.
|
|
456
459
|
*/
|
|
457
460
|
private createTableFromConfig;
|
|
461
|
+
/**
|
|
462
|
+
* Execute raw SQL across all supported dialects.
|
|
463
|
+
* PostgreSQL/MySQL use db.execute(), SQLite uses db.run().
|
|
464
|
+
*/
|
|
465
|
+
private execRawSQL;
|
|
458
466
|
/**
|
|
459
467
|
* Map PostgreSQL SQL types to dialect-specific types.
|
|
460
468
|
*/
|
|
@@ -763,6 +771,11 @@ declare class MigrationRunner {
|
|
|
763
771
|
}>;
|
|
764
772
|
}
|
|
765
773
|
|
|
774
|
+
/**
|
|
775
|
+
* drizzle-kit emits partial unique-index WHERE clauses with `$1`/`$2` placeholders,
|
|
776
|
+
* but Magnet runs DDL as plain strings without bound parameters.
|
|
777
|
+
*/
|
|
778
|
+
declare function sanitizeExecutableMigrationSql(dialect: MigrationDialect, statement: string): string;
|
|
766
779
|
/**
|
|
767
780
|
* Default filename for persisted schema snapshot (used by auto-migration).
|
|
768
781
|
*/
|
|
@@ -1056,4 +1069,4 @@ declare class AutoMigration {
|
|
|
1056
1069
|
run(dialect: MigrationDialect, config: MigrationConfig, directory: string): Promise<void>;
|
|
1057
1070
|
}
|
|
1058
1071
|
|
|
1059
|
-
export { Adapter, AutoMigration, type ColumnChange, DEFAULT_LOCALE, DEFAULT_MIGRATION_CONFIG, DOCUMENT_STATUS, DRIZZLE_CONFIG, DRIZZLE_DB, type DiffResult, type DocumentColumnOptions, type DocumentStatus, type DrizzleConfig, type DrizzleDB, DrizzleDatabaseAdapter, type DrizzleModuleOptions, DrizzleQueryBuilder, type GenerateJsonFn, type GenerateSQLFn, type GeneratedSchema, type IndexChange, InjectModel, LazyQueryBuilder, type Migration, MigrationChecksumError, type MigrationConfig, type MigrationDb, type MigrationDialect, MigrationError, type MigrationGenerateOptions, MigrationGenerator, MigrationHistory, type MigrationHistoryRecord, MigrationLock, MigrationLockError, type MigrationMode, type MigrationResult, MigrationRunner, Prop, type PropMetadata, SNAPSHOT_FILENAME, Schema, SchemaBridge, SchemaDiff, type SchemaDiffResult, type SchemaMetadata, type SnapshotJSON, type TableDefinition, applyDocumentColumns, clearSchemaRegistry, createNeonConnection, createNeonWebSocketConnection, generateSchema, getDrizzleModelToken, getDrizzlePropsMetadata, getDrizzleSchemaMetadata, getOrGenerateSchema, getRegisteredSchemas, isDraft, isPublished, index as sqlGenerators };
|
|
1072
|
+
export { Adapter, AutoMigration, type ColumnChange, DEFAULT_LOCALE, DEFAULT_MIGRATION_CONFIG, DOCUMENT_STATUS, DRIZZLE_CONFIG, DRIZZLE_DB, type DiffResult, type DocumentColumnOptions, type DocumentStatus, type DrizzleConfig, type DrizzleDB, DrizzleDatabaseAdapter, type DrizzleModuleOptions, DrizzleQueryBuilder, type GenerateJsonFn, type GenerateSQLFn, type GeneratedSchema, type IndexChange, InjectModel, LazyQueryBuilder, type Migration, MigrationChecksumError, type MigrationConfig, type MigrationDb, type MigrationDialect, MigrationError, type MigrationGenerateOptions, MigrationGenerator, MigrationHistory, type MigrationHistoryRecord, MigrationLock, MigrationLockError, type MigrationMode, type MigrationResult, MigrationRunner, Prop, type PropMetadata, SNAPSHOT_FILENAME, Schema, SchemaBridge, SchemaDiff, type SchemaDiffResult, type SchemaMetadata, type SnapshotJSON, type TableDefinition, applyDocumentColumns, clearSchemaRegistry, createNeonConnection, createNeonWebSocketConnection, generateSchema, getDrizzleModelToken, getDrizzlePropsMetadata, getDrizzleSchemaMetadata, getOrGenerateSchema, getRegisteredSchemas, isDraft, isPublished, sanitizeExecutableMigrationSql, index as sqlGenerators };
|