/var/www/p4ela.kz/server/delivery/models
Edit: /var/www/p4ela.kz/server/delivery/models/productGroup.js (1487B)
module.exports = (sequelize, Sequelize) => {
const ProductGroup = sequelize.define('productGroup', {
id: {
type: Sequelize.BIGINT,
autoIncrement: true,
allowNull: false,
primaryKey: true,
},
uid: {
type: Sequelize.UUID,
defaultValue: Sequelize.UUIDV4,
},
name: {
type: Sequelize.STRING(100),
allowNull: false,
},
description: {
type: Sequelize.STRING,
allowNull: true,
},
position: {
type: Sequelize.INTEGER,
allowNull: true,
defaultValue: null,
},
image: {
type: Sequelize.STRING,
allowNull: true,
},
createdAt: {
allowNull: false,
type: Sequelize.DATE,
defaultValue: new Date(),
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE,
defaultValue: new Date(),
},
},
{
// add the timestamp attributes (updatedAt, createdAt)
timestamps: true,
// don't delete database entries but set the newly added attribute deletedAt
// to the current date (when deletion was done). paranoid will only work if
// timestamps are enabled
paranoid: true,
// don't use camelcase for automatically added attributes but underscore style
// so updatedAt will be updated_at
underscored: false,
// disable the modification of tablenames; By default, sequelize will automatically
// transform all passed model names (first parameter of define) into plural.
// if you don't want that, set the following
freezeTableName: true,
tableName: 'product_groups',
})
return ProductGroup
}