MsSQL adapter for Loopback
##Installation
Install cellarise-connector-mssql:
npm install -g cellarise-connector-mssql
##Usage
This package uses the mssql package which in turn uses tedious out of the box. Support is also provided for the native Windows MSSQL driver as well as node-tds. See the mssql documentation page for more information.
- Setup dependencies in package.json:
{
...
"dependencies":{
"loopback": "^2.18.0",
"loopback-datasource-juggler": "^2.29.2",
}
...
}
- Use:
var Schema = require("jugglingdb").Schema;
var schema = new Schema("mssql", {host:"YourSqlServer", database:"YourDatabase"});
...
var Schema = require("jugglingdb").Schema;
var schema = new Schema("mssql", {host:"AzureServer", database:"YourDatabase",
username: "YourUserName", password: "YourPassword",
azure: true});
...
- Primary Keys: using anything other than the default 'id' as the primary key will cause the hasMany and belongsTo relationships in jugglingdb to not work, and possibly other oddities as well (so you probably shouldn't use it until it's officially supported).
to specify a custom primary key name for a model use
var AppliesTo = schema.define("AppliesTo", {
AppliesToID: {
type:Number,
primaryKey:true
},
Title: {
type:String,
limit:100
},
Identifier: {
type:String,
limit:100
},
Editable: {
type:Number
}
});
documented by jsdoc-to-markdown.
MIT. All rights not explicitly granted in the license are reserved.
Copyright (c) 2015 Cellarise
[email protected] - "MIT", documented by npm-licenses.