Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

collection mapping and adding files #239

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Conversation

dixitsigdel8
Copy link
Contributor

No description provided.

},

down: async (queryInterface, Sequelize) => {
queryInterface.addColumn('collections', 'filename', Sequelize.STRING)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

down is supposed to be reverse of up not same

},

down: async (queryInterface, Sequelize) => {
queryInterface.addColumn('collections', 'category', Sequelize.STRING)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

down is supposed to be reverse of up not same

},

down: async (queryInterface, Sequelize) => {
await queryInterface.dropTable('collections')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

down is supposed to be reverse of up so it should not delete collection

}
},
{ timestamps: true }
)

Collection.associate = function (models) {
Collection.hasMany(models.CollectionUser, {
as: 'collection',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as is alias for collectionuser so it should not say collection as collection is the main table and associated table should hae different alias


Resources.associate = function (models) {
Resources.belongsToMany(ResourceUser, {
as: 'resource',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as is alias for resourceuser so it should not say collection as collection is the main table and associated table should have different alias possibly followers or just resourceuser

})
}
User.associate = function (models) {
User.hasMany(models.ResourceUser, {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as is alias for resourceuser so it should not say collection as collection is the main table and associated table should have different alias possibly resourceuser

@@ -13,4 +13,17 @@ const User = db.define('users', {
}
}, { timestamps: false })

User.associate = function (models) {
User.hasMany(models.CollectionUser, {
as: 'user',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as is alias for collectionuser so it should not say collection as collection is the main table and associated table should have different alias possibly followers or just collectionuser

@SujalLama SujalLama self-assigned this Jul 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants