2024-10-14 01:23:37 +00:00
|
|
|
const { Sequelize } = require("sequelize");
|
|
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
async up(queryInterface) {
|
|
|
|
|
await queryInterface.createTable("users", {
|
|
|
|
|
ID: {
|
|
|
|
|
type: Sequelize.UUID,
|
|
|
|
|
primaryKey: true,
|
|
|
|
|
defaultValue: Sequelize.UUIDV4,
|
|
|
|
|
allowNull: false,
|
|
|
|
|
},
|
|
|
|
|
NAME_USERS: {
|
|
|
|
|
type: Sequelize.STRING(100),
|
|
|
|
|
allowNull: false,
|
|
|
|
|
},
|
|
|
|
|
EMAIL: {
|
|
|
|
|
type: Sequelize.STRING(100),
|
|
|
|
|
allowNull: false,
|
|
|
|
|
},
|
|
|
|
|
PASSWORD: {
|
|
|
|
|
type: Sequelize.STRING(100),
|
|
|
|
|
allowNull: false,
|
|
|
|
|
},
|
|
|
|
|
ROLE: {
|
|
|
|
|
type: Sequelize.STRING(100),
|
|
|
|
|
allowNull: true,
|
|
|
|
|
},
|
|
|
|
|
PICTURE: {
|
|
|
|
|
type: Sequelize.STRING(1024),
|
|
|
|
|
allowNull: true,
|
|
|
|
|
},
|
2024-11-07 02:18:27 +00:00
|
|
|
IS_VALIDATED: {
|
|
|
|
|
type: Sequelize.TINYINT(1),
|
|
|
|
|
allowNull: true,
|
|
|
|
|
defaultValue: 0,
|
|
|
|
|
},
|
2024-10-14 01:23:37 +00:00
|
|
|
REFRESH_TOKEN: {
|
|
|
|
|
type: Sequelize.STRING(256),
|
|
|
|
|
allowNull: true,
|
|
|
|
|
},
|
|
|
|
|
TIME_USERS: {
|
|
|
|
|
type: Sequelize.DATE,
|
|
|
|
|
defaultValue: Sequelize.NOW,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
await queryInterface.addConstraint("users", {
|
|
|
|
|
fields: ["EMAIL"],
|
|
|
|
|
type: "unique",
|
|
|
|
|
name: "user_unique_email",
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
async down(queryInterface) {
|
|
|
|
|
await queryInterface.dropTable("users");
|
|
|
|
|
},
|
|
|
|
|
};
|