Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@ttoss/postgresdb

Package Overview
Dependencies
Maintainers
2
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ttoss/postgresdb - npm Package Compare versions

Comparing version
0.2.5
to
0.2.6
+6
-4
dist/esm/index.js
/** Powered by @ttoss/config. https://ttoss.dev/docs/modules/packages/config/ */
// src/index.ts
export * from "sequelize-typescript";
// src/sequelize-typescript.ts
import { BelongsTo, BelongsToMany, Column, CreatedAt, DataType, DeletedAt, ForeignKey, HasMany, HasOne, Index, Model, Sequelize, Table, UpdatedAt } from "sequelize-typescript";
// src/initialize.ts
import { Sequelize } from "sequelize-typescript";
var sequelize;

@@ -42,2 +41,5 @@ var initialize = async ({

};
export { initialize };
// src/index.ts
import { Op } from "sequelize";
export { BelongsTo, BelongsToMany, Column, CreatedAt, DataType, DeletedAt, ForeignKey, HasMany, HasOne, Index, Model, Op, Sequelize, Table, UpdatedAt, initialize };
+2
-1
import { ModelCtor, Sequelize, SequelizeOptions, Model } from 'sequelize-typescript';
export * from 'sequelize-typescript';
export { BelongsTo, BelongsToMany, Column, CreatedAt, DataType, DeletedAt, ForeignKey, HasMany, HasOne, Index, Model, ModelCtor, Sequelize, SequelizeOptions, Table, UpdatedAt } from 'sequelize-typescript';
export { Op } from 'sequelize';

@@ -4,0 +5,0 @@ type Options<Models> = Omit<SequelizeOptions, 'models' | 'dialect'> & {

{
"name": "@ttoss/postgresdb",
"version": "0.2.5",
"version": "0.2.6",
"description": "A library to handle PostgreSQL database connections and queries",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -32,2 +32,25 @@ # @ttoss/postgresdb

If you want to use [Docker Compose](https://docs.docker.com/compose/), you can create a `docker-compose.yml` file with the following content:
```yaml
services:
db:
image: postgres
environment:
POSTGRES_PASSWORD: mysecretpassword
volumes:
- db-data:/var/lib/postgresql/data
ports:
- '5432:5432'
volumes:
db-data:
```
And run the following command:
```bash
docker compose up -d
```
### Create a model

@@ -66,5 +89,7 @@

export const db = initialize({ models });
export const db = await initialize({ models });
```
_Note: the script [`sync`](#sync-the-database-schema) will use the `db` object to sync the database schema with the models._
### Environment variables

@@ -97,2 +122,12 @@

Here is an example of a `.env` file:
```env
DB_NAME=postgres
DB_USERNAME=postgres
DB_PASSWORD=mysecretpassword
DB_HOST=localhost
DB_PORT=5432
```
### Sync the database schema

@@ -108,2 +143,4 @@

This command works by importing the `db` object from the `src/db.ts` file and calling the `sync` method on it.
### CRUD operations

@@ -110,0 +147,0 @@