1.0.17 • Published 5 years ago

plum.documentdb.models v1.0.17

Weekly downloads
1
License
ISC
Repository
-
Last release
5 years ago

PLUM.MODELS

This repository contains the sequelize models and the plum.databases.documentdb.

NOTE: Database script development will continue within this repository under the databases/ folder. plum.databases.documentdb 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

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.

# 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
1.0.17

5 years ago

1.0.16-1

5 years ago

1.0.16

6 years ago

1.0.15

6 years ago

1.0.14-10

6 years ago

1.0.14-9

6 years ago

1.0.14-8

6 years ago

1.0.14-7

6 years ago

1.0.14-6

6 years ago

1.0.14-5

6 years ago

1.0.14-4

6 years ago

1.0.14-3

6 years ago

1.0.14-2

6 years ago

1.0.14-1

6 years ago

1.0.13-3

6 years ago

1.0.14

6 years ago

1.0.13-2

6 years ago

1.0.13-1

6 years ago

1.0.13

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.0.6-11

6 years ago

0.0.6-10

6 years ago

0.0.6-9

6 years ago

0.0.6-8

6 years ago

0.0.6-7

6 years ago

0.0.6-6

6 years ago

0.0.6-5

6 years ago

0.0.6-4

6 years ago

0.0.6-3

6 years ago

0.0.6-1

6 years ago

0.0.7-0

6 years ago

0.0.6-0

6 years ago

0.0.5-0

6 years ago

0.0.4-0

6 years ago

0.0.2-0

6 years ago