@forrestjs/service-pg-schema

5.2.2 • Public • Published

pgSchema

Facilitates the maintenance of a simple PostgreSQL schema by running queries at boot time or in case of a TDD reset event.

This service depends on pg-service.

Configuration

pgSchema.build

Default: {}

Provide configuration to the build extension.

pgSchema.seed

Default: {}

Provide configuration to the seed extension.

pgSchema.reset

Default: {}

Provide configuration to the reset extension.

Extensions

$PG_SCHEMA_BUILD

const f1 = {
  target: "$PG_SCHEMA_BUILD",
  handler: async ({ query, config }) => {
    await query("CREATE TABLE ...");
    await query("CREATE TABLE ...");
  }
};

$PG_SCHEMA_SEED

const f1 = {
  target: "$PG_SCHEMA_SEED",
  handler: async ({ query, config }) => {
    await query("INSERT INTO ... ON CONFLICT DO NOTHING");
    await query("INSERT INTO ... ON CONFLICT DO NOTHING");
  }
};

$PG_SCHEMA_RESET

const f1 = {
  target: "$PG_SCHEMA_RESET",
  handler: async ({ query, config }) => {
    await query("DROP TABLE ...");
    await query("DROP TABLE ...");
  }
};

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @forrestjs/service-pg-schema

    Weekly Downloads

    5

    Version

    5.2.2

    License

    MIT

    Unpacked Size

    4.74 kB

    Total Files

    4

    Last publish

    Collaborators

    • marcopeg