@bobbykim/manguito-cms-db 0.1.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.
@@ -0,0 +1,61 @@
1
+ export { sql } from 'drizzle-orm';
2
+ import { DbAdapter, SchemaRegistry, MigrationResult, MigrationStatus } from '@bobbykim/manguito-cms-core';
3
+ import { NodePgDatabase } from 'drizzle-orm/node-postgres';
4
+ import { NeonHttpDatabase } from 'drizzle-orm/neon-http';
5
+
6
+ type DrizzlePostgresInstance = NodePgDatabase<Record<string, never>> | NeonHttpDatabase<Record<string, never>>;
7
+ type PostgresAdapter = DbAdapter & {
8
+ getDb(): DrizzlePostgresInstance;
9
+ };
10
+ type SeederOptions = {
11
+ dryRun?: boolean;
12
+ };
13
+ type SeedResult = {
14
+ roles: {
15
+ inserted: number;
16
+ updated: number;
17
+ deleted: number;
18
+ };
19
+ base_paths: {
20
+ inserted: number;
21
+ updated: number;
22
+ deleted: number;
23
+ };
24
+ };
25
+ type MigrationRunnerOptions = {
26
+ migrationsTable: string;
27
+ migrationsFolder: string;
28
+ };
29
+
30
+ type PostgresAdapterOptions = {
31
+ url?: string;
32
+ serverless?: boolean;
33
+ pool?: {
34
+ max?: number;
35
+ idle_timeout?: number;
36
+ connect_timeout?: number;
37
+ };
38
+ };
39
+ declare function createPostgresAdapter(options?: PostgresAdapterOptions): PostgresAdapter;
40
+
41
+ declare function generateSchemaFile(registry: SchemaRegistry): string;
42
+
43
+ declare function seedSystemTables(db: DrizzlePostgresInstance, registry: SchemaRegistry, options?: SeederOptions): Promise<SeedResult>;
44
+
45
+ declare function runDevMigration(configPath: string): Promise<void>;
46
+ declare function generateMigration(configPath: string, migrationsFolder: string): Promise<string[]>;
47
+ declare function applyMigrations(configPath: string, db: DrizzlePostgresInstance, options: MigrationRunnerOptions): Promise<MigrationResult>;
48
+ declare function getMigrationStatus(db: DrizzlePostgresInstance, options: MigrationRunnerOptions): Promise<MigrationStatus>;
49
+
50
+ type DestructiveOperation = {
51
+ file: string;
52
+ operation: string;
53
+ pattern: 'DROP_COLUMN' | 'DROP_TABLE' | 'ALTER_COLUMN_TYPE';
54
+ };
55
+ type ScanResult = {
56
+ hasDestructiveOperations: boolean;
57
+ operations: DestructiveOperation[];
58
+ };
59
+ declare function scanMigrationFiles(filePaths: string[]): ScanResult;
60
+
61
+ export { type DestructiveOperation, type DrizzlePostgresInstance, type PostgresAdapterOptions, type ScanResult, type SeedResult, type SeederOptions, applyMigrations, createPostgresAdapter, generateMigration, generateSchemaFile, getMigrationStatus, runDevMigration, scanMigrationFiles, seedSystemTables };
@@ -0,0 +1,61 @@
1
+ export { sql } from 'drizzle-orm';
2
+ import { DbAdapter, SchemaRegistry, MigrationResult, MigrationStatus } from '@bobbykim/manguito-cms-core';
3
+ import { NodePgDatabase } from 'drizzle-orm/node-postgres';
4
+ import { NeonHttpDatabase } from 'drizzle-orm/neon-http';
5
+
6
+ type DrizzlePostgresInstance = NodePgDatabase<Record<string, never>> | NeonHttpDatabase<Record<string, never>>;
7
+ type PostgresAdapter = DbAdapter & {
8
+ getDb(): DrizzlePostgresInstance;
9
+ };
10
+ type SeederOptions = {
11
+ dryRun?: boolean;
12
+ };
13
+ type SeedResult = {
14
+ roles: {
15
+ inserted: number;
16
+ updated: number;
17
+ deleted: number;
18
+ };
19
+ base_paths: {
20
+ inserted: number;
21
+ updated: number;
22
+ deleted: number;
23
+ };
24
+ };
25
+ type MigrationRunnerOptions = {
26
+ migrationsTable: string;
27
+ migrationsFolder: string;
28
+ };
29
+
30
+ type PostgresAdapterOptions = {
31
+ url?: string;
32
+ serverless?: boolean;
33
+ pool?: {
34
+ max?: number;
35
+ idle_timeout?: number;
36
+ connect_timeout?: number;
37
+ };
38
+ };
39
+ declare function createPostgresAdapter(options?: PostgresAdapterOptions): PostgresAdapter;
40
+
41
+ declare function generateSchemaFile(registry: SchemaRegistry): string;
42
+
43
+ declare function seedSystemTables(db: DrizzlePostgresInstance, registry: SchemaRegistry, options?: SeederOptions): Promise<SeedResult>;
44
+
45
+ declare function runDevMigration(configPath: string): Promise<void>;
46
+ declare function generateMigration(configPath: string, migrationsFolder: string): Promise<string[]>;
47
+ declare function applyMigrations(configPath: string, db: DrizzlePostgresInstance, options: MigrationRunnerOptions): Promise<MigrationResult>;
48
+ declare function getMigrationStatus(db: DrizzlePostgresInstance, options: MigrationRunnerOptions): Promise<MigrationStatus>;
49
+
50
+ type DestructiveOperation = {
51
+ file: string;
52
+ operation: string;
53
+ pattern: 'DROP_COLUMN' | 'DROP_TABLE' | 'ALTER_COLUMN_TYPE';
54
+ };
55
+ type ScanResult = {
56
+ hasDestructiveOperations: boolean;
57
+ operations: DestructiveOperation[];
58
+ };
59
+ declare function scanMigrationFiles(filePaths: string[]): ScanResult;
60
+
61
+ export { type DestructiveOperation, type DrizzlePostgresInstance, type PostgresAdapterOptions, type ScanResult, type SeedResult, type SeederOptions, applyMigrations, createPostgresAdapter, generateMigration, generateSchemaFile, getMigrationStatus, runDevMigration, scanMigrationFiles, seedSystemTables };