sql.js
sql.js copied to clipboard
sql.js can work with sequelize?
sql.js can work with sequelize?
I'm so surprised this has never been done before, since it's so accessible but so in need of some sugar. This is, however, less a sql.js problem and more a sequelize problem ( as well as other sql ORMs / layers like knex ). Check out #91 - specifically the two replies. Some have made sql.js work with sequelize by patching together an adapter. Give that a try.
@citycide i tried,but not work,i hope sql.js can give a offical example in document.
It's not sequelize, but it might be useful anyway - I've just put out a 1.0 rc for a package I've been working on for a while that allows for using sql.js as a knex backend, along with a document store style API.
Trilogy
TypeORM has sql.js support. https://www.npmjs.com/package/typeorm
I know it's not the answer you hoped for, but TypeORM can be used in javascript projects and I personally find it to be the best ORM I've come across in the node ecosystem.
@citycide is right; this is an ORM's feature to add. Sql.js can't do much about the issue directly without getting it's hands dirty in other teams projects.
Hi. I've made an npm package that could be used to make sql.js
to work with Sequelize by mimicking sqlite3
's behavior:
https://www.npmjs.com/package/sql.js-as-sqlite3
Usage:
import Sequelize from 'sequelize'
import sqlJsAsSqlite3 from 'sql.js-as-sqlite3'
const sequelize = new Sequelize('sqlite://dbname', {
dialectModule: sqlJsAsSqlite3
})
Originally based on this gist: https://gist.github.com/iPotaje/89f48328c682b8a4f6f0b6e3874a6902