Created
November 28, 2018 09:44
-
-
Save Eth3rnit3/bc26193f8a78214a0ec792d267006547 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = { | |
up: (queryInterface, Sequelize) => { | |
return queryInterface.createTable('Companies', { | |
id: { | |
allowNull: false, | |
autoIncrement: true, | |
primaryKey: true, | |
type: Sequelize.INTEGER | |
}, | |
name: { | |
type: Sequelize.STRING | |
}, | |
createdAt: { | |
allowNull: false, | |
type: Sequelize.DATE | |
}, | |
updatedAt: { | |
allowNull: false, | |
type: Sequelize.DATE | |
} | |
}); | |
}, | |
down: (queryInterface, Sequelize) => { | |
return queryInterface.dropTable('Companies'); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = { | |
up: (queryInterface, Sequelize) => { | |
return queryInterface.createTable('Users', { | |
id: { | |
allowNull: false, | |
autoIncrement: true, | |
primaryKey: true, | |
type: Sequelize.INTEGER | |
}, | |
email: { | |
type: Sequelize.STRING | |
}, | |
firstName: { | |
type: Sequelize.STRING | |
}, | |
lastName: { | |
type: Sequelize.STRING | |
}, | |
companyId: { | |
type: Sequelize.INTEGER, | |
allowNull: false, | |
references: { | |
model: 'Companies', | |
key: 'id' | |
} | |
}, | |
createdAt: { | |
allowNull: false, | |
type: Sequelize.DATE | |
}, | |
updatedAt: { | |
allowNull: false, | |
type: Sequelize.DATE | |
} | |
}); | |
}, | |
down: (queryInterface, Sequelize) => { | |
return queryInterface.dropTable('Users'); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = { | |
up: (queryInterface, Sequelize) => { | |
return queryInterface.createTable('WorkingDays', { | |
id: { | |
allowNull: false, | |
autoIncrement: true, | |
primaryKey: true, | |
type: Sequelize.INTEGER | |
}, | |
weekDay: { | |
type: Sequelize.STRING | |
}, | |
workingDate: { | |
type: Sequelize.DATE | |
}, | |
isWorking: { | |
type: Sequelize.BOOLEAN | |
}, | |
createdAt: { | |
allowNull: false, | |
type: Sequelize.DATE | |
}, | |
updatedAt: { | |
allowNull: false, | |
type: Sequelize.DATE | |
} | |
}); | |
}, | |
down: (queryInterface, Sequelize) => { | |
return queryInterface.dropTable('WorkingDays'); | |
} | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
module.exports = { | |
up: (queryInterface, Sequelize) => { | |
return queryInterface.createTable('UsersWorkingDays', { | |
id: { | |
allowNull: false, | |
autoIncrement: true, | |
primaryKey: true, | |
type: Sequelize.INTEGER | |
}, | |
userId: { | |
type: Sequelize.INTEGER, | |
allowNull: false, | |
references: { | |
model: 'Users', | |
key: 'id' | |
} | |
}, | |
workingDayId: { | |
type: Sequelize.INTEGER, | |
allowNull: false, | |
references: { | |
model: 'WorkingDays', | |
key: 'id' | |
} | |
}, | |
createdAt: { | |
allowNull: false, | |
type: Sequelize.DATE | |
}, | |
updatedAt: { | |
allowNull: false, | |
type: Sequelize.DATE | |
} | |
}); | |
}, | |
down: (queryInterface, Sequelize) => { | |
return queryInterface.dropTable('UsersWorkingDays'); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment