@ttoss/postgresdb 0.2.15 → 0.2.17
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 +1 -1
- package/dist/esm/index.js +13 -6
- package/dist/index.d.ts +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -129,7 +129,7 @@ You can set the database connection parameters in two ways:
|
|
|
129
129
|
|
|
130
130
|
### Sync the database schema
|
|
131
131
|
|
|
132
|
-
To [sync](https://sequelize.org/docs/v6/core-concepts/model-basics/#model-synchronization) the database schema with the models, use the [`sync` command](
|
|
132
|
+
To [sync](https://sequelize.org/docs/v6/core-concepts/model-basics/#model-synchronization) the database schema with the models, use the [`sync` command](https://ttoss.dev/docs/modules/packages/postgresdb-cli/):
|
|
133
133
|
|
|
134
134
|
```bash
|
|
135
135
|
pnpm dlx @ttoss/postgresdb-cli sync
|
package/dist/esm/index.js
CHANGED
|
@@ -9,14 +9,19 @@ var initialize = async ({
|
|
|
9
9
|
models,
|
|
10
10
|
...restOptions
|
|
11
11
|
}) => {
|
|
12
|
+
const username = process.env.DB_USERNAME,
|
|
13
|
+
password = process.env.DB_PASSWORD,
|
|
14
|
+
database = process.env.DB_NAME,
|
|
15
|
+
host = process.env.DB_HOST,
|
|
16
|
+
port = Number(process.env.DB_PORT) || 5432;
|
|
12
17
|
if (!sequelize) {
|
|
13
18
|
sequelize = new Sequelize({
|
|
14
19
|
logging: false,
|
|
15
|
-
username
|
|
16
|
-
password
|
|
17
|
-
database
|
|
18
|
-
host
|
|
19
|
-
port
|
|
20
|
+
username,
|
|
21
|
+
password,
|
|
22
|
+
database,
|
|
23
|
+
host,
|
|
24
|
+
port,
|
|
20
25
|
...restOptions,
|
|
21
26
|
define: {
|
|
22
27
|
underscored: true,
|
|
@@ -30,7 +35,9 @@ var initialize = async ({
|
|
|
30
35
|
dialect: "postgres"
|
|
31
36
|
});
|
|
32
37
|
}
|
|
33
|
-
|
|
38
|
+
if (username && password && database && host && port) {
|
|
39
|
+
await sequelize.authenticate();
|
|
40
|
+
}
|
|
34
41
|
const close = sequelize.close;
|
|
35
42
|
return {
|
|
36
43
|
sequelize,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ModelCtor,
|
|
1
|
+
import { ModelCtor, SequelizeOptions, Sequelize, Model } from 'sequelize-typescript';
|
|
2
2
|
export { BelongsTo, BelongsToMany, Column, CreatedAt, DataType, DeletedAt, ForeignKey, HasMany, HasOne, Index, Model, ModelCtor, PrimaryKey, Sequelize, SequelizeOptions, Table, Unique, UpdatedAt } from 'sequelize-typescript';
|
|
3
3
|
export { Op } from 'sequelize';
|
|
4
4
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/postgresdb",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.17",
|
|
4
4
|
"description": "A library to handle PostgreSQL database connections and queries",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "ttoss",
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
],
|
|
25
25
|
"sideEffects": false,
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"pg": "^8.
|
|
28
|
-
"sequelize": "^6.37.
|
|
27
|
+
"pg": "^8.16.3",
|
|
28
|
+
"sequelize": "^6.37.7",
|
|
29
29
|
"sequelize-typescript": "^2.1.6"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"jest": "^
|
|
33
|
-
"tsup": "^8.
|
|
34
|
-
"@ttoss/config": "^1.35.
|
|
32
|
+
"jest": "^30.0.4",
|
|
33
|
+
"tsup": "^8.5.0",
|
|
34
|
+
"@ttoss/config": "^1.35.5"
|
|
35
35
|
},
|
|
36
36
|
"keywords": [
|
|
37
37
|
"database",
|