Up: O2B-825 link logs to LHC fills
Many to many relationship, we need a log environments table
Add association from logs to logLhcfills and from lhcfills to logLhcFills:
// lhcFill.js
LhcFill.associate = (models) => {
...
LhcFill.belongsToMany(
models.Log, { through: 'log_lhcfills' })
};
We need to create a repository
Then we create an adapter
- Adapters convert database objects to entities and vice-versa.
Then we make a migration
npx sequelize-cli model:generate --name LogLhcfills --attributes logId:integer,lhcFillNumber:integer,
To test the migration, I had to undo and redo the migrations, ensuring that the project was running in the background.
Info how I did this here
The naming thing: I have tried