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/es/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
@@ -644,7 +644,7 @@ module.exports = Membership
644
644
645
645
Así que le hemos dado a la tabla de conexiones un nombre que la describe bien, <i>membership</i>. No siempre hay un nombre relevante para una tabla de conexión, en cuyo caso el nombre de la tabla de conexión puede ser una combinación de los nombres de las tablas que se unen, p. <i>user\_teams</i> podría encajar en nuestra situación.
646
646
647
-
Realizamos una pequeña adición al archivo <i>models/index.js</i> para conectar equipos y usuarios a nivel de código mediante el método [belongsToMany](https://sequelize.org/master/manual/assocs.html#implementation-3).
647
+
Realizamos una pequeña adición al archivo <i>models/index.js</i> para conectar equipos y usuarios a nivel de código mediante el método [belongsToMany](https://sequelize.org/docs/v6/core-concepts/assocs/#implementation-2).
648
648
649
649
```js
650
650
const Note = require('./note')
@@ -1152,7 +1152,7 @@ Por ejemplo, la información podría tener la siguiente forma:
1152
1152
}
1153
1153
```
1154
1154
1155
-
Nota: hay varias formas de implementar esta funcionalidad. [Esto](https://sequelize.org/master/manual/advanced-many-to-many.html#the-best-of-both-worlds--the-super-many-to-many-relationship) debería ayuda.
1155
+
Nota: hay varias formas de implementar esta funcionalidad. [Esto](https://sequelize.org/docs/v6/advanced-association-concepts/advanced-many-to-many/#the-best-of-both-worlds-the-super-many-to-many-relationship) debería ayuda.
1156
1156
1157
1157
Tenga en cuenta también que a pesar de tener un campo de matriz <i>listas de lectura</i> en el ejemplo, siempre debe contener exactamente un objeto, la entrada de la tabla de unión que conecta el libro con la lista de lectura del usuario en particular.
1158
1158
@@ -1472,7 +1472,7 @@ module.exports = {
1472
1472
1473
1473
Sin embargo, el problema es que la definición del modelo puede cambiar con el tiempo, por ejemplo, el campo <i>name</i> puede cambiar o su tipo de datos puede cambiar. Las migraciones deben poder realizarse correctamente en cualquier momento de principio a fin, y si las migraciones dependen del modelo para tener cierto contenido, es posible que ya no sea cierto en un mes o un año. Por lo tanto, a pesar del "copiar y pegar", el código de migración debe estar completamente separado del código del modelo.
1474
1474
1475
-
Una solución sería usar la [herramienta de línea de comandos de Sequelize ](https://sequelize.org/master/manual/migrations.html#creating-the-first-model--and-migration-), que genera modelos y migración archivos basados en comandos dados en la línea de comandos. Por ejemplo, el siguiente comando crearía un modelo <i>Users</i> con <i>name</i>, <i>username</i> y <i>admin</i> como atributos, como así como la migración que gestiona la creación de la tabla de la base de datos:
1475
+
Una solución sería usar la [herramienta de línea de comandos de Sequelize ](https://sequelize.org/docs/v6/other-topics/migrations/#creating-the-first-model-and-migration), que genera modelos y migración archivos basados en comandos dados en la línea de comandos. Por ejemplo, el siguiente comando crearía un modelo <i>Users</i> con <i>name</i>, <i>username</i> y <i>admin</i> como atributos, como así como la migración que gestiona la creación de la tabla de la base de datos:
1476
1476
1477
1477
```
1478
1478
npx sequelize-cli model:generate --name User --attributes name:string,username:string,admin:boolean
Copy file name to clipboardExpand all lines: src/content/13/fi/osa13c.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
@@ -639,7 +639,7 @@ module.exports = Membership
639
639
640
640
Olemme siis antaneet liitostaululle kuvaavan nimen, <i>membership</i>. Liitostauluille ei aina löydy yhtä osuvaa nimeä, tällöin liitostaulun nimi voidaan muodostaa yhdistelmänä liitettävien taulujen nimistä esim. <i>user\_teams</i> voisi sopia tilanteeseemme.
641
641
642
-
Tiedostoon <i>models/index.js</i> tulee pieni lisäys, joka liittää metodin [belongsToMany](https://sequelize.org/master/manual/assocs.html#implementation-3) avulla tiimit ja käyttäjät toisiinsa myös koodin tasolla.
642
+
Tiedostoon <i>models/index.js</i> tulee pieni lisäys, joka liittää metodin [belongsToMany](https://sequelize.org/docs/v6/core-concepts/assocs/#implementation-2) avulla tiimit ja käyttäjät toisiinsa myös koodin tasolla.
643
643
644
644
```js
645
645
const Note = require('./note')
@@ -1151,7 +1151,7 @@ Tieto voi olla esim. seuraavassa muodossa:
1151
1151
}
1152
1152
```
1153
1153
1154
-
Huom: tapoja toteuttaa tämä toiminnallisuus on useita. [Tästä](https://sequelize.org/master/manual/advanced-many-to-many.html#the-best-of-both-worlds--the-super-many-to-many-relationship) lienee apua.
1154
+
Huom: tapoja toteuttaa tämä toiminnallisuus on useita. [Tästä](https://sequelize.org/docs/v6/advanced-association-concepts/advanced-many-to-many/#the-best-of-both-worlds-the-super-many-to-many-relationship) lienee apua.
1155
1155
1156
1156
#### Tehtävä 13.22.
1157
1157
@@ -1463,7 +1463,7 @@ Emmekö voisi optimoida koodia siten, että esim. model exporttaisi jaetut osat
1463
1463
1464
1464
Ongelman muodostaa kuitenkin se, että modelin määritelmä voi muuttua ajan myötä, esimerkiksi kenttä <i>name</i> voi muuttaa nimeä tai sen datatyyppi voi vaihtua. Migraatiot tulee pystyä suorittamaan milloin tahansa onnistuneesti alusta loppuun, ja jos migraatiot luottavat että modelilla on tietty sisältö, ei asia enää välttämättä pidä paikkaansa kuukauden tai vuoden kuluttua. Siispä migraatioiden koodin on syytä olla "copy pastesta" huolimatta täysin erillään modelien koodista.
1465
1465
1466
-
Eräs ratkaisu asiaan olisi Sequelizen [komentorivityökalun](https://sequelize.org/master/manual/migrations.html#creating-the-first-model--and-migration-) käyttö, joka luo sekä modelit että migratiotiedostot komentorivillä annettujen komentojen perusteella. Esim. seuraava komento loisi modelin <i>User</i>, jolla on attribuutteina <i>name</i>, <i>username</i> ja <i>admin</i> sekä tietokantataulun luomisen hoitavan migraation:
1466
+
Eräs ratkaisu asiaan olisi Sequelizen [komentorivityökalun](https://sequelize.org/docs/v6/other-topics/migrations/#creating-the-first-model-and-migration) käyttö, joka luo sekä modelit että migratiotiedostot komentorivillä annettujen komentojen perusteella. Esim. seuraava komento loisi modelin <i>User</i>, jolla on attribuutteina <i>name</i>, <i>username</i> ja <i>admin</i> sekä tietokantataulun luomisen hoitavan migraation:
1467
1467
1468
1468
```bash
1469
1469
npx sequelize-cli model:generate --name User --attributes name:string,username:string,admin:boolean
Copy file name to clipboardExpand all lines: src/content/13/zh/part13c.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -692,8 +692,8 @@ module.exports = Membership
692
692
<!-- 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.-->
<!-- 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.-->
<!-- 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.-->
<!-- 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.-->
<!-- 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.-->
<!-- 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.-->
<!-- 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:-->
<!-- 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:-->
0 commit comments