cqlsh当前将命令记录到〜/ .cassandra / cqlsh_history 将其更改为/ var / log / cqlsh
非常方便我猜测有一个可选的cqlsh日志配置文件。我无法在任何地方找到它。 有人对此有所了解吗?
答案 0 :(得分:2)
我认为如果module.exports = function (sequelize, DataTypes) {
var Articles = sequelize.define('articles', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
author: {
type: DataTypes.STRING
},
title: {
type: DataTypes.STRING
},
intro: {
type: DataTypes.TEXT
},
article: {
type: DataTypes.TEXT
},
cd: {
type: DataTypes.DATE
}
}, {
createdAt: 'cd',
updatedAt: false,
freezeTableName: true,
classMethods: {
associate: function (models) {
this.belongsToMany(models.comments, {
through: 'commented_articles'
});
}
}
});
return Articles;
};
Comments:
module.exports = function (sequelize, DataTypes) {
var Comments = sequelize.define('comments', {
id: {
type: DataTypes.INTEGER,
primaryKey: true,
autoIncrement: true
},
id_parent: {
type: DataTypes.INTEGER,
defaultValue: null
},
user_id: {
type: DataTypes.INTEGER,
defaultValue: null
},
nick: {
type: DataTypes.STRING
},
title: {
type: DataTypes.STRING
},
comment: {
type: DataTypes.TEXT
},
plus: {
type: DataTypes.INTEGER,
defaultValue: null,
validate: {
isInt: {
msg: "Must be an integer number."
}
}
},
minus: {
type: DataTypes.INTEGER,
defaultValue: null,
validate: {
isInt: {
msg: "Must be an integer number."
}
}
}
}, {
createdAt: 'cd',
updatedAt: false,
freezeTableName: true,
classMethods: {
associate: function (models) {
this.belongsToMany(models.articles, {
through: 'commented_articles'
});
}
}
});
return Comments;
};
I want to add new comment to article, so probably my routing would look like
module.exports = function (app) {
var articles = require('./../apiMethods/articlesMethods');
app.post('/articles/:id/comments', articles.getSingleArticle);
};
I was trying to use addComment (http://docs.sequelizejs.com/en/latest/docs/associations/)
var models = require('../models'),
MyModel = require('../supportMethods/modelMethods'),
supportModel = new MyModel(models.articles);
module.exports = (function () {
return {
setArticle: function (req, res) {
models.articles.addComments(models.comments, {
user_id: req.body.user_id,
nick: req.body.nick,
title: req.body.title,
comment: req.body.comment
})
}
};
})();
The "commented_articles" is obviously automaticaly generated by squelize and contains article_id, comment_id and cd (row update timestamp).
文件没有更改,我们就不可能。
来自cqlsh.py
:
cqlsh.py
答案 1 :(得分:0)
感谢前面的回答,我刚刚更新了cqlsh.py中的历史目录 还将用户的登录名添加到文件名中。 请注意,普通用户无法创建日志目录,因此它不会出现您想要恢复默认值。
HISTORY_DIR = '/var/log/cql'
HISTORY_FILE = os.getlogin() + "_cqlsh_history"
#fall back to ~/ if central log dir is missing
if not os.path.exists(HISTORY_DIR):
HISTORY_DIR = os.path.expanduser(os.path.join('~', '.cassandra'))
HISTORY = os.path.join(HISTORY_DIR, HISTORY_FILE)