You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/13/en/part13c.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -640,7 +640,7 @@ module.exports = Membership
640
640
641
641
So we have given the connection table a name that describes it well, <i>membership</i>. There is not always a relevant name for a connection table, in which case the name of the connection table can be a combination of the names of the tables that are joined, e.g. <i>user\_teams</i> could fit our situation.
642
642
643
-
We make a small addition to the <i>models/index.js</i> file to connect teams and users at the code level using the [belongsToMany](https://sequelize.org/master/manual/assocs.html#implementation-3) method.
643
+
We make a small addition to the <i>models/index.js</i> file to connect teams and users at the code level using the [belongsToMany](https://sequelize.org/docs/v6/core-concepts/assocs/#implementation-2) method.
644
644
645
645
```js
646
646
const Note = require('./note')
@@ -1150,7 +1150,7 @@ For example, the information could be in the following form:
1150
1150
}
1151
1151
```
1152
1152
1153
-
Note: there are several ways to implement this functionality. [This](https://sequelize.org/master/manual/advanced-many-to-many.html#the-best-of-both-worlds--the-super-many-to-many-relationship) should help.
1153
+
Note: there are several ways to implement this functionality. [This](https://sequelize.org/docs/v6/advanced-association-concepts/advanced-many-to-many/#the-best-of-both-worlds-the-super-many-to-many-relationship) should help.
1154
1154
1155
1155
Note also that despite having an array field <i>readinglists</i>in the example, it should always just contain exactly one object, the join table entry that connects the book to the particular user's reading list.
1156
1156
@@ -1470,7 +1470,7 @@ Couldn't we optimize the code so that, for example, the model exports the shared
1470
1470
1471
1471
However, the problem is that the definition of the model may change over time, forexample the <i>name</i> field may change or its data type may change. Migrations must be able to be performed successfully at any time from start to end, and if the migrations are relying on the model to have certain content, it may no longer be truein a month or a year's time. Therefore, despite the "copy paste", the migration code should be completely separate from the model code.
1472
1472
1473
-
One solution would be to use Sequelize's [command line tool](https://sequelize.org/master/manual/migrations.html#creating-the-first-model--and-migration-), which generates both models and migration files based on commands given at the command line. For example, the following command would create a <i>User</i> model with <i>name</i>, <i>username</i>, and <i>admin</i> as attributes, as well as the migration that manages the creation of the database table:
1473
+
One solution would be to use Sequelize's [command line tool](https://sequelize.org/docs/v6/other-topics/migrations/#creating-the-first-model-and-migration), which generates both models and migration files based on commands given at the command line. For example, the following command would create a <i>User</i> model with <i>name</i>, <i>username</i>, and <i>admin</i> as attributes, as well as the migration that manages the creation of the database table:
1474
1474
1475
1475
```
1476
1476
npx sequelize-cli model:generate --name User --attributes name:string,username:string,admin:boolean
0 commit comments