# plum.documentdb.models

> Plum Models

Latest version **1.0.17** (published 2018-11-30) · ISC license · 0 weekly downloads

## Install

```sh
npm install plum.documentdb.models
pnpm add plum.documentdb.models
yarn add plum.documentdb.models
bun add plum.documentdb.models
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.17 |
| Published | 2018-11-30 |
| First published | 2018-01-20 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 337.5 KB |
| Known vulnerabilities | 0 (+5 in 1 direct dependencies) |
| Install scripts | no |
| Maintainers | franklin_plumlending |

## Links

- npm: https://www.npmjs.com/package/plum.documentdb.models
- npm.io page: https://npm.io/package/plum.documentdb.models

## Dependencies (3)

- [faker](https://npm.io/package/faker.md) ^4.1.0
- [tedious](https://npm.io/package/tedious.md) ^2.1.5
- [sequelize](https://npm.io/package/sequelize.md) ^4.31.2

## Recent versions

- 1.0.17 (latest) — 2018-11-30
- 1.0.16-1 — 2018-11-25
- 1.0.16 — 2018-11-21
- 1.0.15 — 2018-11-20
- 1.0.14-10 — 2018-11-20
- 1.0.14-9 — 2018-11-20
- 1.0.14-8 — 2018-11-20
- 1.0.14-7 — 2018-11-19
- 1.0.14-6 — 2018-11-19
- 1.0.14-5 — 2018-11-19
- 1.0.14-4 — 2018-11-19
- 1.0.14-3 — 2018-11-19
- 1.0.14-2 — 2018-10-30
- 1.0.14-1 — 2018-08-15
- 1.0.13-3 — 2018-08-15
- … 32 more at https://npm.io/package/plum.documentdb.models/versions

## README

# PLUM.MODELS

This repository contains the sequelize models and the [plum.databases.documentdb](https://bitbucket.org/pluminc/plum.databases.documentdb/src/develop/).

NOTE: Database script development will continue within this repository under the *databases/* folder. [plum.databases.documentdb](https://bitbucket.org/pluminc/plum.databases.documentdb/src/develop/) development will be redirected to this repository.

**Requirements**
* MSSQL
* node 8.10+
* jest

**[Optional] MSSQL Setup**

This is how the bitbucket-pipelines is setting up its MSSQL
```bash
docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=yourStrong(!)Password' -p 1433:1433 --name mssql -d microsoft/mssql-server-linux:latest
```

## Development

Create a .env file

example content, configure depending on how you setup your MSSQL server
```
MSSQL_HOST=192.168.99.100
MSSQL_PASSWORD=yourStrong(!)Password
MSSQL_DATABASE=DocumentDb
MSSQL_USER=sa
```

**Running Tests**

The objective of running the tests is to make sure that the `orm models`, `model associations` and `database scripts` are compatible.

```bash
# install all dependencies
npm i

# to test
npm test

# to test individual file/s
jest __test__/Filename1 __test__/Filename2
```

### Expectations

#### What to test
Every change in the model requires an update in the tests under the \_\_tests__/  folder.

* column/attribute changes
     * please update the corresponding factory object under the \_\_tests__/factories/ModelName.js
     * data type testing are also important
* association changes
     * requires updating the factory object also
     * requires adding test under \_\_tests__/ModelName.test.js to determine whether the association is included or populated correctly
* class and instance methods

#### Notes
* When making a PR make sure it passes all the tests first.
* Configure the model the be perfectly equal to the database script configuration
    * ie: varchar limits, types, validation etc.

### How Does this work

1. when running `jest` or `npm test`
     * the setupTests.js determines whether to create the database or truncate the tables under the database
     * creating the database requires executing the following scripts in sequence
          * master-ddl.sql
          * changeset.sql
          * release-changeset.sql
2. setupTests.js runs for every test suite or every test file

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