at time stamp 45.36 what is the realtionship between models bhaiya
At time stamp 45.36 what is the realtionship between models bhaiya
@Aditya-Kushwaha-914550392281281 here we have 3 tables users, posts and comments. The relationship defined in the video is something like this
for each user we can have multiple posts, and comments and for each post we can have multiple comments.
That’s why has many relationship between users - posts and users - comments and posts - comments.
bhaya will u plzz elaborate what is mean in sql oh has many belongs to all that !!!
@Aditya-Kushwaha-914550392281281 has many means:
one user has many posts
so we add a userId as foreign key in posts table
other way of saying it is posts belongs to users
bhaiya also xplain how do we know where to use async and await
@Aditya-Kushwaha-914550392281281 async await is used for asynchronous programming. These are the keywords defined in js, you can read more about them here:
https://javascript.info/async-await
bhaiya what at time stamp 01.54.46 exactly at line 11 what is userrotes here !!!
@Aditya-Kushwaha-914550392281281 i think you should know this by now, we are exporting the user Route for other files to use here.
at timestamp 01.55.50 what is .findone
one last thing bhiaya yeh .findone and .findall ko thoda explain krdo!!!
@Aditya-Kushwaha-914550392281281 we are using sequelize (an ORM for database), there in sequelize documentation findOne and findAll is defined, it is the sequelize API, we just have to call these functions, actual query handing will be done by sequelize for us.
To read about these methods in details refer sequelize documentation.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
bhaiya i dont know why my wakatime icon not shpwing on vs code status bar i checked twice that wakatime status bar activity is true means on still its not showing ,my activity i only able to check my activity on broser by logging in
@Aditya-Kushwaha-914550392281281 it must be some rendering issue, try reinstalling it, if it still not appears then there might be some vs code specific issue. As you said it is recording you time, just not showing the icon, then you can ignore it.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
SequelizeForeignKeyConstraintError: Cannot add or update a child row: a foreign key constraint fails (cbmedia
.posts
, CONSTRAINT posts_ibfk_1
FOREIGN KEY (userId
) REFERENCES users
(id
) ON DELETE SET NULL ON UPDATE CASCADE) Bhaiya iss Error Ka Kya Mtlb Hai
@Aditya-Kushwaha-914550392281281 it is self explanatory error, the entry you are trying to delete is being used as a foreign key in some other table, that’s why mysql is giving the error. Try removing the entries from other table first.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.
INSERT INTO posts
(id
,title
,body
,createdAt
,updatedAt
,userId
) VALUES (DEFAULT,?,?,?,?,?); (node:16176) UnhandledPromiseRejectionWarning: SequelizeForeignKeyConstraintError: Cannot add or update a child row: a foreign key constraint fails (cbmedia
.posts
, CONSTRAINT posts_ibfk_1
FOREIGN KEY (userId
) REFERENCES users
(id
) ON DELETE SET NULL ON UPDATE CASCADE) at Query.formatError (g:\socialmedia\node_modules\sequelize\lib\dialects\mysql\query.js:228:16) when am adding posts this error occus i exactly do same whatever taught in the video