@omnitron-dev/titan-database 0.4.13 → 0.4.15

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.
Files changed (2) hide show
  1. package/README.md +14 -0
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -31,6 +31,20 @@ Pass a PostgreSQL connection URL from application configuration and add the retu
31
31
 
32
32
  Apply migrations explicitly through `@omnitron-dev/titan-database/migration`. Creating the DI module does not create tables or run migrations. Use the runner's own transaction, retry and checksum options; the module's `transactionOptions` and `migrations` configuration groups are currently not applied.
33
33
 
34
+ For a file-based SQL migration, export the three values returned by `defineSqlMigration` as named exports. Save this example as `001_create_notes.ts`.
35
+
36
+ ```ts
37
+ import { defineSqlMigration } from '@omnitron-dev/titan-database/migration';
38
+
39
+ export const { up, down, checksum } = defineSqlMigration(
40
+ '001_create_notes',
41
+ 'CREATE TABLE notes (id bigint PRIMARY KEY)',
42
+ 'DROP TABLE notes',
43
+ );
44
+ ```
45
+
46
+ `loadMigrationFiles` takes the migration name from the filename. The named `checksum` binds both SQL statements to the recorded migration. Without it, the compatibility runner hashes the JavaScript functions, which can have identical source for different SQL. Preserve the recorded checksum of each applied migration and put subsequent SQL changes in a new file.
47
+
34
48
  `requirePostgresSchema` from `@omnitron-dev/titan-database/readiness` checks a declared schema contract through an existing pool. It reads metadata without applying DDL or taking ownership of that pool. Its result covers the declared requirements, not every possible difference between database schemas.
35
49
 
36
50
  ## Documentation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnitron-dev/titan-database",
3
- "version": "0.4.13",
3
+ "version": "0.4.15",
4
4
  "description": "Database module for Titan framework with Kysely, migrations, RLS, and multi-dialect support",
5
5
  "author": "LuxQuant",
6
6
  "license": "MIT",
@@ -68,13 +68,13 @@
68
68
  "@kysera/rls": "^0.10.2",
69
69
  "@kysera/soft-delete": "^0.10.2",
70
70
  "@kysera/timestamps": "^0.10.2",
71
- "@omnitron-dev/eventemitter": "0.4.13",
71
+ "@omnitron-dev/eventemitter": "0.4.15",
72
72
  "@types/better-sqlite3": "^9.6.0",
73
73
  "kysely": "^0.29.8",
74
74
  "zod": "^4.6.7"
75
75
  },
76
76
  "peerDependencies": {
77
- "@omnitron-dev/titan": "0.4.13",
77
+ "@omnitron-dev/titan": "0.4.15",
78
78
  "better-sqlite3": "^13.0.3",
79
79
  "mysql2": "^3.20.0",
80
80
  "pg": "^8.20.0"
@@ -91,7 +91,7 @@
91
91
  }
92
92
  },
93
93
  "devDependencies": {
94
- "@omnitron-dev/titan": "0.4.13",
94
+ "@omnitron-dev/titan": "0.4.15",
95
95
  "@types/node": "^26.6.6",
96
96
  "@typescript/native": "npm:typescript@^7.0.2",
97
97
  "reflect-metadata": "^0.2.2",
@@ -109,5 +109,5 @@
109
109
  "clean": "rm -rf dist",
110
110
  "typecheck": "tsc --noEmit"
111
111
  },
112
- "gitHead": "7a37cf16ed460da669590b8cecc498b56ad2d7ad"
112
+ "gitHead": "5c94fdda7da59f8587a61b49964968cfac64e9fb"
113
113
  }