-
Notifications
You must be signed in to change notification settings - Fork 8
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
base: main
Are you sure you want to change the base?
Conversation
}, | ||
|
||
down: async (queryInterface, Sequelize) => { | ||
queryInterface.addColumn('collections', 'filename', Sequelize.STRING) |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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') |
There was a problem hiding this comment.
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
api/models/collectionModel.js
Outdated
} | ||
}, | ||
{ timestamps: true } | ||
) | ||
|
||
Collection.associate = function (models) { | ||
Collection.hasMany(models.CollectionUser, { | ||
as: 'collection', |
There was a problem hiding this comment.
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
api/models/resourceModel.js
Outdated
|
||
Resources.associate = function (models) { | ||
Resources.belongsToMany(ResourceUser, { | ||
as: 'resource', |
There was a problem hiding this comment.
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
api/models/userModel.js
Outdated
}) | ||
} | ||
User.associate = function (models) { | ||
User.hasMany(models.ResourceUser, { |
There was a problem hiding this comment.
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
api/models/userModel.js
Outdated
@@ -13,4 +13,17 @@ const User = db.define('users', { | |||
} | |||
}, { timestamps: false }) | |||
|
|||
User.associate = function (models) { | |||
User.hasMany(models.CollectionUser, { | |||
as: 'user', |
There was a problem hiding this comment.
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
836ebfc
to
248accc
Compare
f10b1e1
to
8376107
Compare
No description provided.