Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

feathers-sequelize

A service adapter for Sequelize an SQL ORM

feathers, feathers-plugin, sequel, sequelize, mysql, sqlite, mariadb, postgres, pg, mssql, database

readme

feathers-sequelize

CI Download Status Discord

Caution: When you're using feathers v4 and want to upgrade to feathers v5, please make sure to read the migration guide.

NOTE: This is the version for Feathers v5. For Feathers v4 use feathers-sequelize v6

A Feathers database adapter for Sequelize, an ORM for Node.js. It supports PostgreSQL, MySQL, MariaDB, SQLite and MSSQL and features transaction support, relations, read replication and more.

Very Important: Before using this adapter you have to be familiar with both, the Feathers Basics and general use of Sequelize. For associations and relations see the associations section. This adapter may not cover all use cases but they can still be implemented using Sequelize models directly in a Custom Feathers service.

npm install --save feathers-sequelize@pre

And one of the following:

npm install --save pg pg-hstore
npm install --save mysql2 // For both mysql and mariadb dialects
npm install --save sqlite3
npm install --save tedious // MSSQL

Important: feathers-sequelize implements the Feathers Common database adapter API and querying syntax. For more information about models and general Sequelize usage, follow up in the Sequelize documentation.

API

new SequelizeService(options)

Returns a new service instance initialized with the given options.

const Model = require('./models/mymodel');
const { SequelizeService } = require('feathers-sequelize');

app.use('/messages', new SequelizeService({ Model }));
app.use('/messages', new SequelizeService({ Model, id, events, paginate }));

Options:

  • Model (required) - The Sequelize model definition
  • id (optional, default: primary key of the model) - The name of the id field property. Will use the first property with primaryKey: true by default.
  • raw (optional, default: true) - Runs queries faster by returning plain objects instead of Sequelize models.
  • Sequelize (optional, default: Model.sequelize.Sequelize) - The Sequelize instance
  • events (optional) - A list of custom service events sent by this service
  • paginate (optional) - A pagination object containing a default and max page size
  • multi (optional) - Allow create with arrays and update and remove with id null to change multiple items. Can be true for all methods or an array of allowed methods (e.g. [ 'remove', 'create' ])
  • operatorMap (optional) - A mapping from query syntax property names to to Sequelize secure operators
  • operators (optional) - A list of additional query parameters to allow (e..g [ '$regex', '$geoNear' ]). Default is the supported operators

params.sequelize

When making a service method call, params can contain an sequelize property which allows to pass additional Sequelize options. This can e.g. be used to retrieve associations. Normally this wil be set in a before hook:

app.service('messages').hooks({
  before: {
    find(context) {
      // Get the Sequelize instance. In the generated application via:
      const sequelize = context.app.get('sequelizeClient');
      const { User } = sequelize.models;

      context.params.sequelize = {
        include: [ User ]
      }

      return context;
    }
  }
});

Other options that params.sequelize allows you to pass can be found in Sequelize querying docs. Beware that when setting a top-level where property (usually for querying based on a column on an associated model), the where in params.sequelize will overwrite your query.

operatorMap

Sequelize deprecated string based operators a while ago for security reasons. Starting at version 4.0.0 feathers-sequelize converts queries securely, so you can still use string based operators listed below. If you want to support additional Sequelize operators, the operatorMap service option can contain a mapping from query parameter name to Sequelize operator. By default supported are:

'$eq',
'$ne',
'$gte',
'$gt',
'$lte',
'$lt',
'$in',
'$nin',
'$like',
'$notLike',
'$iLike',
'$notILike',
'$or',
'$and'
// Find all users with name similar to Dav
app.service('users').find({
  query: {
    name: {
      $like: 'Dav%'
    }
  }
});
GET /users?name[$like]=Dav%

Caveats

Sequelize raw queries

By default, all feathers-sequelize operations will return raw data (using raw: true when querying the database). This results in faster execution and allows feathers-sequelize to interoperate with feathers-common hooks and other 3rd party integrations. However, this will bypass some of the "goodness" you get when using Sequelize as an ORM:

  • custom getters/setters will be bypassed
  • model-level validations are bypassed
  • associated data loads a bit differently
  • ...and several other issues that one might not expect

Don't worry! The solution is easy. Please read the guides about working with model instances.

Working with MSSQL

When using MSSQL as the database, a default sort order always has to be applied, otherwise the adapter will throw an Invalid usage of the option NEXT in the FETCH statement. error. This can be done in your model with:

model.beforeFind(model => model.order.push(['id', 'ASC']))

Or in a hook like this:

module.exports = function (options = {}) {
  return async context => {
    const { query = {} } = context.params;
    // Sort by id field ascending (or any other property you want)
    // See https://docs.feathersjs.com/api/databases/querying.html#sort
    const $sort = { id: 1 };

    context.params.query = {
      $sort: {

      },
      ...query
    }

    return context;
  }
}

Primary keys

All tables used by a feathers-sequelize service require a primary key. Although it is common practice for many-to-many tables to not have a primary key, this service will break if the table does not have a primary key. This is because most service methods require an ID and because of how feathers maps services to URLs.

Example

Here is an example of a Feathers server with a messages SQLite Sequelize Model:

$ npm install @feathersjs/feathers @feathersjs/errors @feathersjs/express @feathersjs/socketio sequelize feathers-sequelize sqlite3

In app.js:

import path from 'path';
import { feathers } from '@feathersjs/feathers';
import express from '@feathersjs/express';
import socketio from '@feathersjs/socketio';

import Sequelize from 'sequelize';
import SequelizeService from 'feathers-sequelize';

const sequelize = new Sequelize('sequelize', '', '', {
  dialect: 'sqlite',
  storage: path.join(__dirname, 'db.sqlite'),
  logging: false
});

const Message = sequelize.define('message', {
  text: {
    type: Sequelize.STRING,
    allowNull: false
  }
}, {
  freezeTableName: true
});

// Create an Express compatible Feathers application instance.
const app = express(feathers());

// Turn on JSON parser for REST services
app.use(express.json());
// Turn on URL-encoded parser for REST services
app.use(express.urlencoded({ extended: true }));
// Enable REST services
app.configure(express.rest());
// Enable Socket.io services
app.configure(socketio());
// Create an in-memory Feathers service with a default page size of 2 items
// and a maximum size of 4
app.use('/messages', new SequelizeService({
  Model: Message,
  paginate: {
    default: 2,
    max: 4
  }
}));
app.use(express.errorHandler());

Message.sync({ force: true }).then(() => {
  // Create a dummy Message
  app.service('messages').create({
    text: 'Message created on server'
  }).then(message => console.log('Created message', message));
});

// Start the server
const port = 3030;

app.listen(port, () => {
  console.log(`Feathers server listening on port ${port}`);
});

Run the example with node app and go to localhost:3030/messages.

Associations

Embrace the ORM

The documentation on Sequelize associations and relations is essential to implementing associations with this adapter and one of the steepest parts of the Sequelize learning curve. If you have never used an ORM, let it do a lot of the heavy lifting for you!

Setting params.sequelize.include

Once you understand how the include option works with Sequelize, you will want to set that option from a before hook in Feathers. Feathers will pass the value of context.params.sequelize as the options parameter for all Sequelize method calls. This is what your hook might look like:

// GET /my-service?name=John&include=1
function (context) {
  const { include, ...query } = context.params.query;

   if (include) {
      const AssociatedModel = context.app.services.fooservice.Model;
      context.params.sequelize = {
         include: [{ model: AssociatedModel }]
      };
      // Update the query to not include `include`
      context.params.query = query;
   }

   return context;
}

Underneath the hood, feathers will call your models find method sort of like this:

// YourModel is a sequelize model
const options = Object.assign({ where: { name: 'John' }}, context.params.sequelize);
YourModel.findAndCount(options);

For more information, follow up up in the Sequelize documentation for associations and this issue.

Querying

Additionally to the common querying mechanism this adapter also supports all Sequelize query operators.

Note: This adapter supports an additional $returning parameter for patch and remove queries. By setting params.$returning = false it will disable feathers and sequelize from returning what was changed, so mass updates can be done without overwhelming node and/or clients.

Querying a nested column

To query based on a column in an associated model, you can use Sequelize's nested column syntax in a query. The nested column syntax is considered an operator by Feathers, and so each such usage has to be whitelisted.

Example:

// Find a user with post.id == 120
app.service('users').find({
  query: {
    '$post.id$': 120,
    include: {
      model: posts
    }
  }
});

For this case to work, you'll need to add '$post.id$' to the service options' 'whitelist' property.

Working with Sequelize Model instances

It is highly recommended to use raw queries, which is the default. However, there are times when you will want to take advantage of Sequelize Instance methods. There are two ways to tell feathers to return Sequelize instances:

  1. Set { raw: false } in a "before" hook:
     function rawFalse(context) {
         if (!context.params.sequelize) context.params.sequelize = {};
         Object.assign(context.params.sequelize, { raw: false });
         return context;
     }
     hooks.before.find = [rawFalse];
  2. Use the new hydrate hook in the "after" phase:

     const hydrate = require('feathers-sequelize/hooks/hydrate');
     hooks.after.find = [hydrate()];
    
     // Or, if you need to include associated models, you can do the following:
      function includeAssociated (context) {
          return hydrate({
             include: [{ model: context.app.services.fooservice.Model }]
          }).call(this, context);
      }
      hooks.after.find = [includeAssociated];

    For a more complete example see this gist.

Important: When working with Sequelize Instances, most of the feathers-hooks-common will no longer work. If you need to use a common hook or other 3rd party hooks, you should use the "dehydrate" hook to convert data back to a plain object:

const { dehydrate, hydrate } = require('feathers-sequelize');
const { populate } = require('feathers-hooks-common');

hooks.after.find = [hydrate(), doSomethingCustom(), dehydrate(), populate()];

Validation

Sequelize by default gives you the ability to add validations at the model level. Using an error handler like the one that comes with Feathers your validation errors will be formatted nicely right out of the box!

Testing sequelize queries in isolation

If you wish to use some of the more advanced features of sequelize, you should first test your queries in isolation (without feathers). Once your query is working, you can integrate it into your feathers app.

1. Build a test file

Creat a temporary file in your project root like this:

// test.js
const app = require('./src/app');
// run setup to initialize relations
app.setup();
const seqClient = app.get('sequelizeClient');
const SomeModel = seqClient.models['some-model'];
const log = console.log.bind(console);

SomeModel.findAll({
   /*
    * Build your custom query here. We will use this object later.
    */
}).then(log).catch(log);

And then run this file like this:

node test.js

Continue updating the file and running it until you are satisfied with the results.

2. Integrate the query using a "before" hook

Once your have your custom query working to your satisfaction, you will want to integrate it into your feathers app. Take the guts of the findAll operation above and create a "before" hook:

function buildCustomQuery(context) {
    context.params.sequelize = {
       /*
        * This is the same object you passed to "findAll" above.
        * This object is *shallow merged* onto the underlying query object
        * generated by feathers-sequelize (it is *not* a deep merge!).
        * The underlying data will already contain the following:
        *   - "where" condition based on query paramters
        *   - "limit" and "offset" based on pagination settings
        *   - "order" based $sort query parameter
        * You can override any/all of the underlying data by setting it here.
        * This gives you full control over the query object passed to sequelize!
        */
    };
}

someService.hooks({
    before: {
        find: [buildCustomQuery]
    }
});

Migrations

Migrations with feathers and sequelize are quite simple. This guide will walk you through creating the recommended file structure, but you are free to rearrange things as you see fit. The following assumes you have a migrations folder in the root of your app.

Initial Setup: one-time tasks

npm install sequelize-cli --save -g
  • Create a .sequelizerc file in your project root with the following content:
const path = require('path');

module.exports = {
  'config': path.resolve('migrations/config.js'),
  'migrations-path': path.resolve('migrations/scripts'),
  'seeders-path': path.resolve('migrations/seeders'),
  'models-path': path.resolve('migrations/models.js')
};
  • Create the migrations config in migrations/config.js:
const app = require('../src/app');
const env = process.env.NODE_ENV || 'development';
const dialect = 'postgres'; // Or your dialect name

module.exports = {
  [env]: {
    dialect,
    url: app.get(dialect),
    migrationStorageTableName: '_migrations'
  }
};
  • Define your models config in migrations/models.js:
const Sequelize = require('sequelize');
const app = require('../src/app');
const sequelize = app.get('sequelizeClient');
const models = sequelize.models;

// The export object must be a dictionary of model names -> models
// It must also include sequelize (instance) and Sequelize (constructor) properties
module.exports = Object.assign({
  Sequelize,
  sequelize
}, models);

Migrations workflow

The migration commands will load your application and it is therefore required that you define the same environment variables as when running your application. For example, many applications will define the database connection string in the startup command:

DATABASE_URL=postgres://user:pass@host:port/dbname npm start

All of the following commands assume that you have defined the same environment variables used by your application.

ProTip: To save typing, you can export environment variables for your current bash/terminal session:

export DATABASE_URL=postgres://user:pass@host:port/db

Create a new migration

To create a new migration file, run the following command and provide a meaningful name:

sequelize migration:create --name="meaningful-name"

This will create a new file in the migrations/scripts folder. All migration file names will be prefixed with a sortable data/time string: 20160421135254-meaningful-name.js. This prefix is crucial for making sure your migrations are executed in the proper order.

NOTE: The order of your migrations is determined by the alphabetical order of the migration scripts in the file system. The file names generated by the CLI tools will always ensure that the most recent migration comes last.

Add the up/down scripts:

Open the newly created migration file and write the code to both apply and undo the migration. Please refer to the sequelize migration functions for available operations. Do not be lazy - write the down script too and test! Here is an example of converting a NOT NULL column accept null values:

'use strict';

module.exports = {
  up: function (queryInterface, Sequelize) {
    return queryInterface.changeColumn('tableName', 'columnName', {
      type: Sequelize.STRING,
      allowNull: true
    });
  },

  down: function (queryInterface, Sequelize) {
    return queryInterface.changeColumn('tableName', 'columnName', {
      type: Sequelize.STRING,
      allowNull: false
    });
  }
};

ProTip: As of this writing, if you use the changeColumn method you must always specify the type, even if the type is not changing.

ProTip: Down scripts are typically easy to create and should be nearly identical to the up script except with inverted logic and inverse method calls.

Keeping your app code in sync with migrations

The application code should always be up to date with the migrations. This allows the app to be freshly installed with everything up-to-date without running the migration scripts. Your migrations should also never break a freshly installed app. This often times requires that you perform any necessary checks before executing a task. For example, if you update a model to include a new field, your migration should first check to make sure that new field does not exist:

'use strict';

module.exports = {
  up: function (queryInterface, Sequelize) {
    return queryInterface.describeTable('tableName').then(attributes => {
      if ( !attributes.columnName ) {
        return queryInterface.addColumn('tableName', 'columnName', {
          type: Sequelize.INTEGER,
          defaultValue: 0
        });
      }
    })
  },

  down: function (queryInterface, Sequelize) {
    return queryInterface.describeTable('tableName').then(attributes => {
      if ( attributes.columnName ) {
        return queryInterface.removeColumn('tableName', 'columnName');
      }
    });
  }
};

Apply a migration

The CLI tools will always run your migrations in the correct order and will keep track of which migrations have been applied and which have not. This data is stored in the database under the _migrations table. To ensure you are up to date, simply run the following:

sequelize db:migrate

ProTip: You can add the migrations script to your application startup command to ensure that all migrations have run every time your app is started. Try updating your package.json scripts attribute and run npm start:

scripts: {
    start: "sequelize db:migrate && node src/"
}

Undo the previous migration

To undo the last migration, run the following command:

sequelize db:migrate:undo

Continue running the command to undo each migration one at a time - the migrations will be undone in the proper order.

Note: - You shouldn't really have to undo a migration unless you are the one developing a new migration and you want to test that it works. Applications rarely have to revert to a previous state, but when they do you will be glad you took the time to write and test your down scripts!

Reverting your app to a previous state

In the unfortunate case where you must revert your app to a previous state, it is important to take your time and plan your method of attack. Every application is different and there is no one-size-fits-all strategy for rewinding an application. However, most applications should be able to follow these steps (order is important):

  1. Stop your application (kill the process)
  2. Find the last stable version of your app
  3. Count the number of migrations which have been added since that version
  4. Undo your migrations one at a time until the db is in the correct state
  5. Revert your code back to the previous state
  6. Start your app

Migrating

feathers-sequelize 4.0.0 comes with important security and usability updates.

Important: For general migration information to the new database adapter functionality see crow.docs.feathersjs.com/migrating.html#database-adapters.

The following breaking changes have been introduced:

  • All methods now take params.sequelize into account
  • All methods allow additional query parameters
  • Multiple updates are disabled by default (see the multi option)
  • Upgraded to secure Sequelize operators (see the operators option)
  • Errors no longer contain Sequelize specific information. The original Sequelize error can be retrieved on the server via:
const { ERROR } = require('feathers-sequelize');

try {
  await sequelizeService.doSomethign();
} catch(error) {
  // error is a FeathersError
  // Safely retrieve the Sequelize error
  const sequelizeError = error[ERROR];
}

License

Copyright (c) 2022

Licensed under the MIT license.

Migrate to Feathers v5 (dove)

There are several breaking changes for feathers-sequelize in Feathers v5. This guide will help you to migrate your existing Feathers v4 application to Feathers v5.

Named export

The default export of feathers-sequelize has been removed. You now have to import the SequelizeService class directly:

const { SequelizeService } = require('feathers-sequelize');

app.use('/messages', new SequelizeService({ ... }));

This follows conventions from feathers v5.

operators / operatorMap

Feathers v5 introduces a convention for options.operators and options.filters. The way feathers-sequelize worked in previous version is not compatible with these conventions. Please read https://dove.feathersjs.com/guides/migrating.html#custom-filters-operators first.

The old options.operators object is renamed to options.operatorMap:

const { SequelizeService } = require('feathers-sequelize');
const { Op } = require('sequelize');

app.use('/messages', new SequelizeService({
  Model,
  // operators is now operatorMap:
  operatorMap: {
    $between: Op.between
  }
}));

The new options.operators option is an array of allowed operators.

filters

Feathers v5 introduces a convention for options.operators and options.filters. The way feathers-sequelize worked in previous version is not compatible with these conventions. Please read https://dove.feathersjs.com/guides/migrating.html#custom-filters-operators first.

Feathers v5 introduces a new filters option. It is an object to verify filters. Here you need to add $dollar.notation$ operators, if you have some.

const { SequelizeService } = require('feathers-sequelize');

app.use('/messages', new SequelizeService({
  Model,
  filters: {
    '$and': true,
    '$person.name$': true
  }
}));

whitelist

Feathers v5 introduces a convention for options.operators and options.filters. The way feathers-sequelize worked in previous version is not compatible with these conventions. Please read https://dove.feathersjs.com/guides/migrating.html#custom-filters-operators.

changelog

Changelog

Unreleased

Full Changelog

Merged pull requests:

v7.0.2 (2023-06-21)

Full Changelog

Closed issues:

  • Bug: patch:multi only patches 10 items with default pagination #363

v7.0.1 (2023-04-03)

Full Changelog

Merged pull requests:

  • chore(dependencies): Update all dependencies #414 (daffl)

v7.0.0 (2023-02-24)

Full Changelog

Merged pull requests:

v7.0.0-pre.1 (2023-01-06)

Full Changelog

Closed issues:

  • Since version 6.4.0 getting "error: GeneralError: column "id" does not exist" #406

v6.4.0 (2022-11-15)

Full Changelog

Merged pull requests:

v6.3.6 (2022-10-26)

Full Changelog

v6.3.5 (2022-10-26)

Full Changelog

Merged pull requests:

  • chore(dependencies): Update all dependencies #399 (daffl)
  • chore(dependencies): Update all dependencies #398 (daffl)
  • chore(dependencies): Update all dependencies #395 (daffl)
  • chore(dependencies): Update all dependencies #394 (daffl)

v7.0.0-pre.0 (2022-10-04)

Full Changelog

Closed issues:

  • how to set field to NULL on patch request? #397

v6.3.4 (2022-06-08)

Full Changelog

Merged pull requests:

  • Do not allow raw attribute selects #393 (daffl)
  • chore(dependencies): Update all dependencies #392 (daffl)
  • chore(dependencies): Update all dependencies #391 (daffl)

v6.3.3 (2022-04-13)

Full Changelog

Closed issues:

  • Unable to modify hook result of referenced models #365

Merged pull requests:

  • Prevent query prototype polution #389 (daffl)
  • chore(dependencies): Update all dependencies #388 (daffl)
  • chore(dependencies): Update all dependencies #387 (daffl)
  • chore(dependencies): Update all dependencies #386 (daffl)
  • chore(dependencies): Update all dependencies #381 (daffl)
  • chore(dependencies): Update all dependencies #380 (daffl)
  • chore(dependencies): Update all dependencies #379 (daffl)

v6.3.2 (2021-10-19)

Full Changelog

v6.3.1 (2021-10-14)

Full Changelog

v6.3.0 (2021-10-14)

Full Changelog

Closed issues:

  • Got 404 No Record Found while using include in before get hooks #377
  • id is not set correctly to a non-null value when using multi-create and throws an error instead of creating #374
  • Query by Association #373
  • How can I use a limit and a required in an include? #369
  • Use attributes exclude #361
  • Sequelize v6 #358

Merged pull requests:

v6.2.0 (2020-04-29)

Full Changelog

Closed issues:

  • Model.update() method used by patch() does not support includes. #347
  • Patching with query does not return expected results in query property was patched #346
  • Incorrect format of DataTypes.BIGINT.UNSIGNED fields into the produced json #341
  • How to include $like operator in service.js #336
  • An in-range update of @feathersjs/adapter-commons is breaking the build 🚨 #335
  • $sort by RAND() #330
  • queryWithCurrentUser gives NotFound: No record found for id 'null' #329
  • Before HOOK to be able to GET soft deleted item #328
  • Eagerly return associations of Create #327
  • An in-range update of @feathersjs/adapter-commons is breaking the build 🚨 #325

Merged pull requests:

v6.1.0 (2019-10-07)

Full Changelog

Merged pull requests:

v6.0.2 (2019-09-29)

Full Changelog

Closed issues:

  • FeathersJS Inserts 2 records into MySql from 1 REST call #321
  • An in-range update of @feathersjs/express is breaking the build 🚨 #318
  • Many to many relation result duplicate objects #317
  • An in-range update of dtslint is breaking the build 🚨 #315
  • Patch/Remove methods mess up Find method #313
  • Warning When Starting Feathers when using Sequelize 5.10.0 with feathers-sequelize 5.1.3 #305

Merged pull requests:

v6.0.1 (2019-07-22)

Full Changelog

Closed issues:

  • UPDATE forces raw false #311
  • After hook in service not running when same endpoint called in quick succession #308
  • upgrade sequelize to avoid SQL injection vuln #306

Merged pull requests:

v6.0.0 (2019-07-06)

Full Changelog

Closed issues:

  • How to use Sequelize increment method with this adapter #303
  • An in-range update of pg is breaking the build 🚨 #301
  • Feather-sequelize $or operator not working #299
  • An in-range update of sqlite3 is breaking the build 🚨 #298
  • An in-range update of body-parser is breaking the build 🚨 #296
  • An in-range update of sequelize is breaking the build 🚨 #295
  • options.whitelist overwrites merged operators and whitelist #292
  • Underscored foreignKeys failing when upgrading to v5 #287

Merged pull requests:

  • Add TypeScript definitions and upgrade tests to Feathers 4 #304 (daffl)
  • Lock CI to Node 11 for now #302 (daffl)

v5.1.3 (2019-04-18)

Full Changelog

Closed issues:

  • $iLike operator declared incorrectly in default operators #290

Merged pull requests:

v5.1.2 (2019-04-17)

Full Changelog

Implemented enhancements:

  • Unflatten results of raw queries #149

Closed issues:

  • How to return man-to-many relationship? #288

Merged pull requests:

v5.1.1 (2019-04-09)

Full Changelog

Closed issues:

  • belongsToMany Association #285

Merged pull requests:

  • Add returning: true for bulk creates #286 (daffl)

v5.1.0 (2019-04-05)

Full Changelog

Closed issues:

  • include association's association #284

v5.0.1 (2019-03-30)

Full Changelog

Implemented enhancements:

  • Is there a way to createQuery? #228
  • count is slow on large data sets #178

Closed issues:

  • Sequelize V5 #283
  • Incorrect Error Type #269

v5.0.0 (2019-03-30)

Full Changelog

Merged pull requests:

v4.1.1 (2019-02-27)

Full Changelog

Closed issues:

  • Multi Patch fails when used with default pagination #279
  • Question: Multiple database connection #278

Merged pull requests:

v4.1.0 (2019-01-25)

Full Changelog

Closed issues:

  • Sorted and limited query does not respect the sort first #272

Merged pull requests:

v4.0.8 (2019-01-10)

Full Changelog

Merged pull requests:

  • Make sure that queries with id property work properly #271 (daffl)
  • Update @feathersjs/adapter-commons to the latest version 🚀 #270 (greenkeeper[bot])

v4.0.7 (2018-12-29)

Full Changelog

Merged pull requests:

  • Add default params to hook-less methods #268 (daffl)

v4.0.6 (2018-12-27)

Full Changelog

Merged pull requests:

v4.0.5 (2018-12-26)

Full Changelog

Merged pull requests:

  • Added getModel override param passing tests and fixes #265 (AndrewJDR)

v4.0.4 (2018-12-22)

Full Changelog

Merged pull requests:

  • Only filter plain objects in query #264 (daffl)

v4.0.3 (2018-12-21)

Full Changelog

Closed issues:

  • getModel() overriding with parameters broken in 4.0.x #261

Merged pull requests:

  • Fix recursive getModel call when using this.Model #263 (daffl)

v4.0.2 (2018-12-21)

Full Changelog

Merged pull requests:

  • Make sure that Symbols are included in filtered query #260 (daffl)

v4.0.1 (2018-12-21)

Full Changelog

Merged pull requests:

  • Add service.Model back #259 (daffl)
  • Convert all Sequelize errors into a safe FeathersError #258 (daffl)

v4.0.0 (2018-12-20)

Full Changelog

Implemented enhancements:

  • Use Sequelize Symbol based operators for better security #244

Fixed bugs:

  • Ensure params are always passed through to all service calls #234
  • Remove error details in production #231

Closed issues:

  • Include as array, no longer working #239
  • feathers-sequelize with hook update only selected columns. #238

Merged pull requests:

  • Securely hide original Sequelize error #257 (daffl)
  • Upgrade to @feathersjs/adapter-commons and latest common service features #256 (daffl)
  • Update dependencies #255 (daffl)
  • Migrate tests to async/await #254 (daffl)
  • De-duplicate connection setup #253 (daffl)
  • Fixed issue where params are ignored on update service calls. #252 (AndrewJDR)

v3.1.3 (2018-10-29)

Full Changelog

Closed issues:

  • Include hook doesn't work on create #242
  • Warning messages when using "sequelize db:migrate" #240
  • Extending service class fails when transpiling to ES5 #237
  • Example in readme.md doesn't work #236
  • How to use raw where clause #233
  • Associations on Create #230
  • Valid password characters can break the connection string #229
  • Does Feathers-Sequalize support class and instance methods? #225
  • Find & include data structure shape #224
  • Fix bug Pg-Native #222
  • Connection pool #221
  • Question: Feathers Sequelize raw query and feathers service without using model. #215
  • Sub include relations with Sequelize: Query erro #203

Merged pull requests:

v3.1.2 (2018-06-07)

Full Changelog

Fixed bugs:

  • Paginate option for a feathers-sequelize service is not working as expected #186

Closed issues:

  • options object extra data lost #209

Merged pull requests:

  • Default paginate option value set to false instead of empty object #217 (alex-friedl)
  • keeping options data with the service #216 (pyvkd)

v3.1.1 (2018-06-03)

Full Changelog

Closed issues:

  • Custom id field does not work in get request with id #210
  • Question about executing sql string using feathers-sequelize #208
  • Version 10 of node.js has been released #205
  • sub include relations with Sequelize: Query error #204

Merged pull requests:

v3.1.0 (2018-03-27)

Full Changelog

Merged pull requests:

  • Support params.query in update() #189 (TimNZ)

v3.0.2 (2018-03-25)

Full Changelog

Closed issues:

  • Requesting for associated data returns empty #197
  • Is it possible to query for related data through REST? #195
  • sequelize version 4.35 not permit $in #193
  • Custom getter not being called properly. #129

Merged pull requests:

v3.0.1 (2018-03-07)

Full Changelog

Closed issues:

  • raw: false, does not work with with Buzzard #184
  • "error: NotFound: No record found for id" when calling with socket.io #179

Merged pull requests:

v3.0.0 (2017-12-04)

Full Changelog

Closed issues:

  • Populate joined table on create #180
  • Return associated data from joined table? #177
  • How to work with the relationship from URL query? #176

Merged pull requests:

v2.4.0 (2017-11-06)

Full Changelog

Merged pull requests:

v2.3.2 (2017-10-14)

Full Changelog

Closed issues:

  • The patch on postgres is selecting every row from the table before updating #168
  • Can't override id field when declaring a (MySQL) service #164
  • Run tests against all sequelize dialects #163
  • Adding model includes returns incorrect paging count #161
  • Raw associations prevent pagination total being available #137
  • update not working? #125

Merged pull requests:

v2.3.1 (2017-09-06)

Full Changelog

Closed issues:

  • [Question] Should new tests be using Postgres or SQLite or both? #154
  • Multiple rows delete #153

Merged pull requests:

v2.3.0 (2017-08-19)

Full Changelog

Closed issues:

  • use inside php server #151
  • Patch returns Model instance by default #146
  • Run tests against PostgreSQL #105
  • Avoid findAndCount if paginate is false #95

Merged pull requests:

  • Finalize running tests against Postgresql #152 (daffl)

v2.2.1 (2017-08-08)

Full Changelog

Closed issues:

  • All service methods should take into account the query parameter #143

Merged pull requests:

v2.2.0 (2017-07-24)

Full Changelog

Closed issues:

  • Is there any full example about database relationship? #141
  • Query fails when using the $contains operator with a single value #135
  • Allow scope() to be used for operations #130

Merged pull requests:

v2.1.0 (2017-07-13)

Full Changelog

Closed issues:

  • Hydrate is not compatible with Sequelize 4.x #138
  • Update only one parameter in row #136
  • Hook Includes not working #134
  • Hydrate not being exported correctly #133
  • An in-range update of feathers-rest is breaking the build 🚨 #132
  • No record found #128
  • many to many (through model, with extra field in junction table) error "<Model1> is not associated to <Model2>" #126
  • find total is always zero when raw is false #118
  • N:N relation using React Native #109

Merged pull requests:

  • Add compatibility for documented hydration hook imports #140 (daffl)
  • fix(hydrate): Fix the factory function so that Sequelize 4.x is supported #139 (dschnare)
  • Update sequelize to the latest version 🚀 #123 (greenkeeper[bot])

v2.0.1 (2017-06-09)

Full Changelog

Closed issues:

  • Allow custom primary keys #122
  • Investigate issue where getters, setters not being called #116
  • Model.create ignoring field and virtual setters #113
  • An in-range update of feathers is breaking the build 🚨 #112
  • Using include breaks the find method query #111
  • An in-range update of feathers-errors is breaking the build 🚨 #110
  • Add lean attribute to automatically call toJSON? #19
  • Add a toJSON bundled hook like mongoose #18

Merged pull requests:

v2.0.0 (2017-05-03)

Full Changelog

Closed issues:

  • update() breaks when sequelize configured with raw:true #99
  • Discuss querying of NULL values #96

Merged pull requests:

v1.4.5 (2017-03-26)

Full Changelog

Merged pull requests:

v1.4.4 (2017-03-24)

Full Changelog

Closed issues:

  • Relation between Models not working. #98
  • Can we create nested models in one go? #97
  • Add example for model relations #20

Merged pull requests:

  • checking for the toJSON method on the instance before calling it #100 (lowip)

v1.4.3 (2017-03-17)

Full Changelog

Merged pull requests:

  • use 'returning: true' for postgres to keep patch and its response atomic #93 (MichaelErmer)

v1.4.2 (2017-03-14)

Full Changelog

Merged pull requests:

v1.4.1 (2017-03-10)

Full Changelog

Closed issues:

  • $populate does not seem to work #89
  • updated_at column does not get updated at PATCH request #88
  • Suggested pattern to create a multi model service #86
  • GroupBy issue #84
  • Concat and other sequelize functions #81
  • Solved: How to add relationship #80
  • Consider creating a sequelize instance during updates: #63

Merged pull requests:

v1.4.0 (2016-11-11)

Full Changelog

Closed issues:

  • TypeError: Cannot read property '2' of null #71
  • ES6/Babel #68

Merged pull requests:

v1.3.3 (2016-09-28)

Full Changelog

Merged pull requests:

v1.3.2 (2016-08-25)

Full Changelog

Closed issues:

  • Cannot call remove service method when id field name is custom #60
  • Make params optional #59
  • Exporting utils.js #58

Merged pull requests:

v1.3.1 (2016-07-20)

Full Changelog

Merged pull requests:

v1.3.0 (2016-07-08)

Full Changelog

Fixed bugs:

  • We shouldn't remove properties from original objects #49

Merged pull requests:

v1.2.0 (2016-06-17)

Full Changelog

Merged pull requests:

v1.1.6 (2016-06-15)

Full Changelog

Closed issues:

  • TypeError: Cannot read property '$nin' of undefined #45

Merged pull requests:

  • Allow querying for null values #47 (daffl)

v1.1.5 (2016-06-10)

Full Changelog

Closed issues:

  • Custom id column name #40
  • Find() generates an invalid query with pagination but no order. #39
  • Private method _get() not processing parameters #22
  • Support $search #15

Merged pull requests:

v1.1.4 (2016-03-10)

Full Changelog

Closed issues:

  • Create method should support options param #25

Merged pull requests:

  • adding support for sequelize options #27 (ekryski)

v1.1.3 (2016-03-09)

Full Changelog

Closed issues:

  • Hook result data shouldn't have sequelize info #24
  • Service methods should reject with feathers error instance rather throwing in-place #23
  • When i need force sync? #21
  • How to retrieve records for a many to many relationship? #16

Merged pull requests:

v1.1.2 (2016-02-24)

Full Changelog

Closed issues:

  • How do you retrieve associations in the response? #12

Merged pull requests:

v1.1.1 (2016-02-02)

Full Changelog

Merged pull requests:

v1.1.0 (2016-01-30)

Full Changelog

Closed issues:

  • How to add the model name in the REST response #11
  • Review patch and remove many for consistency #8

Merged pull requests:

  • Use internal methods instead of service methods directly #13 (daffl)

v1.0.10 (2016-01-24)

Full Changelog

Merged pull requests:

v1.0.9 (2016-01-11)

Full Changelog

Merged pull requests:

  • added value conversion for $sort to utils getOrder #9 (thebarndog)

v1.0.8 (2016-01-09)

Full Changelog

Merged pull requests:

v1.0.7 (2016-01-06)

Full Changelog

Closed issues:

  • Expose Sequelize lib #6

v1.0.6 (2015-12-29)

Full Changelog

v1.0.5 (2015-12-21)

Full Changelog

v1.0.4 (2015-12-21)

Full Changelog

v1.0.3 (2015-12-21)

Full Changelog

v1.0.2 (2015-12-21)

Full Changelog

v1.0.1 (2015-12-19)

Full Changelog

v1.0.0 (2015-12-19)

Full Changelog

Merged pull requests:

v0.2.1 (2015-12-18)

Full Changelog

Closed issues:

  • only one instance of babel-polyfill is allowed #3

Merged pull requests:

v0.2.0 (2015-12-13)

Full Changelog

Closed issues:

  • Take a look at feathers-orm-service which uses sequelize #1

Merged pull requests:

  • Migration to ES6 classes and Promises, support for pagination #2 (daffl)

v0.1.0 (2015-11-23)

Full Changelog

* This Changelog was automatically generated by github_changelog_generator