[英]feathersjs/nodejs sequelize
I am using feathers js and sequelize.我正在使用羽毛 js 和续集。 I already have existing models like users.
我已经有像用户这样的现有模型。
Now my question is if I wanted to add a new column to user model/database for example user_firstname should I directly add that to the model.js?现在我的问题是,如果我想向用户模型/数据库添加一个新列,例如 user_firstname,我应该直接将它添加到 model.js 吗? or I need to create migrations for that?
或者我需要为此创建迁移?
How does it affect locally and on stating or production?它如何影响当地以及对陈述或生产的影响? Thank you.
谢谢你。
module.exports = function (app) {
const sequelizeClient = app.get('sequelizeClient');
const users = sequelizeClient.define('users', {
username: {
type: DataTypes.STRING(320),
allowNull: false,
unique: true,
},
password: {
type: DataTypes.STRING,
allowNull: true,
},
If you don't use sequelize.sync()
then you should create a migration, modify a model, build the app, deploy the app, run migrations on a DB that is related to the deployed app to make sure that the app is corresponding to a DB (a structure and data).如果你不使用
sequelize.sync()
那么你应该创建一个迁移,修改一个 model,构建应用程序,部署应用程序,在与部署的应用程序相关的数据库上运行迁移以确保应用程序是对应的到数据库(结构和数据)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.