# nergal

> ``` npm run test ```

Latest version **0.7.1** (published 2021-04-11) · ISC license · 0 weekly downloads

## Install

```sh
npm install nergal
pnpm add nergal
yarn add nergal
bun add nergal
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.7.1 |
| Published | 2021-04-11 |
| First published | 2020-08-01 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 10 |
| Unpacked size | 104.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Alexey Zauzin |
| Maintainers | lehadnk |

## Links

- npm: https://www.npmjs.com/package/nergal
- npm.io page: https://npm.io/package/nergal

## Dependencies (10)

- [dotenv](https://npm.io/package/dotenv.md) ^8.2.0
- [sqlite3](https://npm.io/package/sqlite3.md) ^4.2.0
- [inversify](https://npm.io/package/inversify.md) ^5.0.1
- [db-migrate](https://npm.io/package/db-migrate.md) ^0.11.11
- [discord.js](https://npm.io/package/discord.js.md) ^12.3.2
- [typescript](https://npm.io/package/typescript.md) ^3.9.7
- [@types/node](https://npm.io/package/@types/node.md) ^14.6.0
- [@types/dotenv](https://npm.io/package/@types/dotenv.md) ^8.2.0
- [@types/sqlite3](https://npm.io/package/@types/sqlite3.md) ^3.1.6
- [db-migrate-sqlite3](https://npm.io/package/db-migrate-sqlite3.md) ^0.4.0

## Recent versions

- 0.7.1 (latest) — 2021-04-11
- 0.7.0 — 2021-04-11
- 0.6.4 — 2021-04-03
- 0.6.3 — 2020-10-14
- 0.6.2 — 2020-10-14
- 0.6.1 — 2020-10-14
- 0.6.0 — 2020-10-08
- 0.5.3 — 2020-09-24
- 0.5.2 — 2020-09-24
- 0.5.1 — 2020-09-23
- 0.5.0 — 2020-09-23
- 0.4.0 — 2020-09-19
- 0.3.7 — 2020-09-19
- 0.3.6 — 2020-09-19
- 0.3.5 — 2020-08-31
- … 9 more at https://npm.io/package/nergal/versions

## README

# Running tests
```
npm run test
```

# Compilation
```
npm run compile
```

# Project setup
Add following commands into the package.json scripts structure:
```json
{
    "scripts": {
        "nergal": "node_modules/.bin/ts-node console.ts",
        "migrate": "node_modules/db-migrate/bin/db-migrate",
        "start": "node_modules/.bin/ts-node run.ts",
        "compile": "node_modules/typescript/bin/tsc --listEmittedFiles",
        "test": "node_modules/.bin/ts-node test/startup.ts && node_modules/.bin/mocha \"./test/*.test.ts\""
      },
}
```

Then init the project:
```shell script
node node_modules/nergal/init
```

# Migrations
To create new migration run
```
npm run migrate create <migration name>
```

Creating new table:
```js
await db.createTable('votes', {
    id: { type: 'int', primaryKey: true, autoIncrement: true},
    participant_id: 'int',
    voter_discord_id: 'string',
  });
```

Adding indexes:
```js
db.addIndex('votes', 'unique_voter_and_participant', ['participant_id', 'voter_discord_id'], true);
```

Dropping table
```js
return db.dropTable('votes');
```

Adding column
```js
await db.addColumn('votes', 'voter_discord_name', 'string');
```

Removing column
```js
db.removeColumn('votes');
```

Running migrations
```
npm run migrate up
```

# Running in dev mode
```
npm run start
```

# Running console commands
```
npm run console 
```

---
_Source: https://npm.io/package/nergal · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
