-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path20240425041201-create-profile.js
49 lines (49 loc) · 1.05 KB
/
20240425041201-create-profile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
'use strict';
/** @type {import('sequelize-cli').Migration} */
module.exports = {
async up(queryInterface, Sequelize) {
await queryInterface.createTable('Profiles', {
id: {
allowNull: false,
primaryKey: true,
type: Sequelize.UUID,
defaultValue: Sequelize.UUIDV4
},
age: {
type: Sequelize.INTEGER,
allowNull: false
},
bio: {
type: Sequelize.TEXT
},
address: {
type: Sequelize.STRING,
allowNull: false
},
image: {
type: Sequelize.STRING,
},
userId: {
type: Sequelize.UUID,
allowNull: false,
references: {
model: 'Users',
key: 'id'
},
onDelete: 'CASCADE',
onUpdate: 'CASCADE'
},
createdAt: {
allowNull: false,
type: Sequelize.DATE
},
updatedAt: {
allowNull: false,
type: Sequelize.DATE
}
});
},
async down(queryInterface, Sequelize) {
await queryInterface.dropTable('Profiles');
}
};