d-band / koa-orm Goto Github PK
View Code? Open in Web Editor NEWkoa orm using sequelize & sk2 (fork from knex)
koa orm using sequelize & sk2 (fork from knex)
I use "sequelize": "^6.3.5",
But a warning appears
(node:3876) [SEQUELIZE0003] DeprecationWarning: String based operators are deprecated. Please use Symbol based operators for better security, read more at https://sequelize.org/master/manual/querying.html#operators
To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:
.travis.yml
If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.
Greenkeeper has checked the engines
key in any package.json
file, the .nvmrc
file, and the .travis.yml
file, if present.
engines
was only updated if it defined a single version, not a range..nvmrc
was updated to Node.js 10.travis.yml
was only changed if there was a root-level node_js
that didn’t already include Node.js 10, such as node
or lts/*
. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.For many simpler .travis.yml
configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
我在controllers层中的方法
const { game } = ctx.orm()
game.beforeDestroy(activity=>{
activity.IS_DELETE = 0
})
删除的没有没有执行hook
Branch | Build failing 🚨 |
---|---|
Dependency | sequelize |
Current Version | 4.4.10 |
Type | dependency |
This version is covered by your current version range and after updating it in your project the build failed.
sequelize is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪
The new version differs by 2 commits.
8de9a27
build: use node 4 for release
615e95f
feat(dependency): move env-cmd to dev dependencies (#8116)
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot 🌴
How do you declare a model with this ORM?
hello,
has you can see here sequelize.import is deprecated.
I would like to use the extends model with the init function.
So can you replace the import function use in /lib/models.js ?
const model = sequelize.import(join(modelPath, file));
models[model.name] = model;
With this :
let loadedModel = require(join(modelPath, file));
if (loadedModel.prototype && typeof loadedModel.prototype === 'object') {
// ES6 module compatibility with init
let modelES6 = loadedModel.init(sequelize, sequelize.Sequelize.DataTypes);
models[modelES6.name] = modelES6;
}
else{
if (typeof loadedModel === 'object') {
// ES6 module compatibility with default like sequelize.import
loadedModel = loadedModel.default;
}
let model = loadedModel(sequelize, sequelize.Sequelize.DataTypes);
models[model.name] = model;
}
Another thing, you can filter the models for association detection like this :
Object.values(models)
.filter(model => typeof model.associate === 'function')
.forEach(model => model.associate(models));
Sequelize v3 is using
pool: {
maxConnections: 10,
minConnections: 0,
maxIdleTime: 30000
}
But v4 and v5 is changed into this
pool: {
max: 5,
min: 0,
acquire: 30000,
idle: 10000
}
So, old configs params will not works if upgrade to v4, v5.
let Game = db.define('modelName', {
id: { type: 'serial', key: true },
game_name: { type:'text',size:40 },
game_code: { type:'text',size:20 },
game_desc: { type: 'text' },
preview_pic: { type: 'text'},
preview_link: { type:'text'},
game_logo: { type:'text'},
user_launch: { type:'integer'},
game_type: { type:'integer'},
defaultconfig: { type:'text'},
lottery_platform: { type:'integer'}
});
ctx.orm 属性打印出来
undefined:
{ id: [Getter/Setter],
game_name: [Getter/Setter],
game_code: [Getter/Setter],
game_desc: [Getter/Setter],
preview_pic: [Getter/Setter],
preview_link: [Getter/Setter],
game_logo: [Getter/Setter],
user_launch: [Getter/Setter],
game_type: [Getter/Setter],
defaultconfig: [Getter/Setter],
lottery_platform: [Getter/Setter] } }
app.use(async function (ctx) {
// const raws = await .sql.select().from('yhd_fn_game').query();
console.log(ctx.orm('test'));
const products = await ctx.orm().findAll({
where: { id:6 }
});
ctx.body = products;
});
报错 ctx.orm(...).findAll is not a function
用法问题吗
Can this ORM be used to talk to Postgresql using async/await?
Branch | Build failing 🚨 |
---|---|
Dependency | sequelize |
Current Version | 4.11.3 |
Type | dependency |
This version is covered by your current version range and after updating it in your project the build failed.
sequelize is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪
The new version differs by 1 commits.
ba7aa33
fix(model): properly serialize WHERE attributes in soft delete (#8383)
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot 🌴
6.0.2
to 6.1.0
.This version is covered by your current version range and after updating it in your project the build failed.
mocha is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
options
parameter (@plroebuck).jsonc
extension (@sstephant)These are soft-deprecated, and will emit a warning upon use. Support will be removed in (likely) the next major version of Mocha:
this.skip()
in "before each" hooks (@juergba)--allow-uncaught
for uncaught exceptions thrown inside hooks (@givanse)and some regressions:
Suite
cloning by copying root
property (@fatso83)The new version differs by 28 commits.
f4fc95a
Release v6.1.0
bd29dbd
update CHANGELOG for v6.1.0 [ci skip]
aaf2b72
Use cwd-relative pathname to load config file (#3829)
b079d24
upgrade deps as per npm audit fix; closes #3854
e87c689
Deprecate this.skip() for "after all" hooks (#3719)
81cfa90
Copy Suite property "root" when cloning; closes #3847 (#3848)
8aa2fc4
Fix issue 3714, hide pound icon showing on hover header on docs page (#3850)
586bf78
Update JS-YAML to address security issue (#3845)
d1024a3
Update doc examples "tests.html" (#3811)
1d570e0
Delete "/docs/example/chai.js"
ade8b90
runner.js: "self.test" undefined in Browser (#3835)
0098147
Replace findup-sync with find-up for faster startup (#3830)
d5ba121
Remove "package" flag from sample config file because it can only be passes as CLI arg (#3793)
a3089ad
update package-lock
75430ec
Upgrade yargs-parser dependency to avoid loading 2 copies of yargs
There are 28 commits in total.
See the full diff
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
squel.registerValueHandler(Date, function(date) {
return '"' + date.getFullYear() + '-' + (date.getMonth()+1) + '-' + date.getDate() + '"';
});
1.6.1
to 1.6.2
.This version is covered by your current version range and after updating it in your project the build failed.
mysql2 is a devDependency of this project. It might not break your production code or affect downstream projects, but probably breaks your build or test tools, which may prevent deploying or publishing.
There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.
Your Greenkeeper Bot 🌴
Branch | Build failing 🚨 |
---|---|
Dependency | sequelize |
Current Version | 4.7.0 |
Type | dependency |
This version is covered by your current version range and after updating it in your project the build failed.
sequelize is a direct dependency of this project this is very likely breaking your project right now. If other packages depend on you it’s very likely also breaking them.
I recommend you give this issue a very high priority. I’m sure you can resolve this 💪
The new version differs by 2 commits.
fc942b0
fix(instance): toJSON should return cloned version of internal object (#8171)
d4b8212
docs(models-definitions): Fix wrong url for configuration section (#8168)
See the full diff
There is a collection of frequently asked questions and of course you may always ask my humans.
Your Greenkeeper Bot 🌴
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.