fastify-cockroachdb
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -7,4 +7,4 @@ "use strict"; | ||
async function cockroachConnector(fastify, options) { | ||
// CockroachDB is a Postgre SQL Database | ||
options.settings.dialect = "postgres"; | ||
// CockroachDB is a Postgre SQL Database so override custom dialect | ||
options.settings ? (options.settings.dialect = "postgres") : undefined; | ||
const sequelize = new Sequelize( | ||
@@ -31,4 +31,5 @@ options.database, | ||
if (options.models.length !== 0) { | ||
decorator.models = {}; | ||
options.models.forEach(model => { | ||
decorator[ | ||
decorator.models[ | ||
model.alias | ||
@@ -35,0 +36,0 @@ ? model.alias |
{ | ||
"name": "fastify-cockroachdb", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "A Fastify plugin for creating a CockroachDB connection through the Sequelize ORM", | ||
@@ -18,2 +18,5 @@ "main": "index.js", | ||
}, | ||
"engines": { | ||
"node": ">=8" | ||
}, | ||
"repository": { | ||
@@ -20,0 +23,0 @@ "type": "git", |
# Fastify CockroachDB Plugin using Sequelize ORM | ||
[![NPM](https://nodei.co/npm/fastify-cockroachdb.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/fastify-cockroachdb/) | ||
[![NPM](https://nodei.co/npm/fastify-cockroachdb.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/fastify-cockroachdb/) | ||
[![CircleCI](https://circleci.com/gh/alex-ppg/fastify-cockroachdb.svg?style=svg)](https://circleci.com/gh/alex-ppg/fastify-cockroachdb) | ||
@@ -5,0 +6,0 @@ ## Installation |
15
test.js
@@ -0,1 +1,3 @@ | ||
"use strict"; | ||
const fastify = require("fastify")(); | ||
@@ -14,15 +16,2 @@ const fs = require("fs"); | ||
user: "maxroach", | ||
password: "", | ||
settings: { | ||
dialect: "postgres", | ||
port: 26257, | ||
logging: false, | ||
dialectOptions: { | ||
ssl: { | ||
ca: fs.readFileSync("certs/ca.crt").toString(), | ||
key: fs.readFileSync("certs/client.maxroach.key").toString(), | ||
cert: fs.readFileSync("certs/client.maxroach.crt").toString() | ||
} | ||
} | ||
}, | ||
models: [ | ||
@@ -29,0 +18,0 @@ { |
44797
6
91
71