Skip to content

divinebovine/OneToOneFailure

Repository files navigation

One to One Failure

This repository exists to reproduce a bug found in sequelize auto model generation where a one to one relationship has a one to many relationship

Generated Code

Expected

  foos.hasOne(bars, { as: "bar", foreignKey: "foo_id"});

Actual

  foos.hasMany(bars, { as: "bars", foreignKey: "foo_id"});

Testing

  1. Run docker-compose up --build -d

  2. Connect to database

psql "hostaddr=127.0.0.1 \
port=5555 \
user=postgres \
password=SomePassword \
dbname=postgres"
  1. Inspect the schema
\d foos

\d bars

  1. Install node dependencies:
npm i
  1. Generate models:
npm start
  1. Confirm models/init-models.js models the relationship as a one to many (foo -> bars).

About

Test repository for sequelize auto

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published