Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Self-reference FK's never created #13

Closed
tanepiper opened this issue Aug 28, 2010 · 5 comments
Closed

Self-reference FK's never created #13

tanepiper opened this issue Aug 28, 2010 · 5 comments

Comments

@tanepiper
Copy link

When creating a model that has a parent/child relationshop, the FK is never created.

An example is my Role model:

exports.getRoleModel = function(Sequelize, sequelize) {
sequelize.define('Role', {
name : Sequelize.STRING,
priority : Sequelize.INTEGER
});

Role.hasMany('children', Role);
Role.belongsTo('parent', Role);

A FK for the parentId is never created.

@assertchris
Copy link

I think this is related to the relation key name ticket you already have open...

@tanepiper
Copy link
Author

I thought it may have been, but as I wasn't sure I opened this one too. Hopefully something can be done about it, at the moment I'm having to use node-mysql to do custom stuff, but would like to use sequelize exclusively if I can

@assertchris
Copy link

My guess is that it created the PK roleId and then when the time comes to creating the FK (which according to your previous ticket would be roleId) it skips it assuming it is already present...

@sdepold
Copy link
Member

sdepold commented Sep 11, 2010

please try the example again and let me know if it works with the latest repo version :)

@tanepiper
Copy link
Author

The way for doing associations is vastly improved, they are working very well for me now - much prefer this new syntax

sdepold pushed a commit that referenced this issue Sep 15, 2022
* feat(oracle): add oracle dialect support (#1)

* feat(oracle): add oracle dialect support

* fix: addressing review comments (#7)

* fix: addressing review comments

* fix: minor fixes done (#9)

* fix: minor fixes to the review comments

* fix: merge from sequelize-v6

* fix: enable newly added unit tests for Oracle dialect

* fix: remove dangling comma (#13)

* fix: doc gen is fixed

* fix: autogenerate the primary constraint name (#14)

* fix: autogenerate the primary constraint name

* fix: remove trailing comma

* fix: make changes to ORADERBY as per v6 sync

* fix: move test-unit-oracle above test-unit-all

* fix: rename getInsertQueryReturnIntoBinds to
  populateInsertQueryReturnIntoBinds

* fix: reorder parameters for function populateInsertQueryReturnIntoBinds

* fix: incorporated review comments (#16)

* fix: incorporated review comments

* fix: modify string empty check with !
WikiRik pushed a commit that referenced this issue Sep 22, 2022
* feat(oracle): add oracle dialect support (#1)

* feat(oracle): add oracle dialect support

* fix: addressing review comments (#7)

* fix: addressing review comments

* fix: minor fixes done (#9)

* fix: minor fixes to the review comments

* fix: merge from sequelize-v6

* fix: enable newly added unit tests for Oracle dialect

* fix: remove dangling comma (#13)

* fix: doc gen is fixed

* fix: autogenerate the primary constraint name (#14)

* fix: autogenerate the primary constraint name

* fix: remove trailing comma

* fix: make changes to ORADERBY as per v6 sync

* fix: move test-unit-oracle above test-unit-all

* fix: rename getInsertQueryReturnIntoBinds to
  populateInsertQueryReturnIntoBinds

* fix: reorder parameters for function populateInsertQueryReturnIntoBinds

* fix: incorporated review comments (#16)

* fix: incorporated review comments

* fix: modify string empty check with !

* feat: support for Oracle DB 18c

* Oracle DB version change

* added stop-oracle for 18

* fix: changes to DB version query

* fix: cleanup

* fix: describetable query fix

* fix: dbVersion to remove round trip and 18.4 json test fix

* fix: removed dbversion

* fix: removed comment

* fix: testing a feature

* fix: testing a feature

* fix: testing a feature

* fix: testing a feature

* fix: testing a feature

* fix: testing a feature

* fix: test

* fix: test

* fix: test

* fix: test

* fix: using semver to coerce version sring

* fix: update to instant client latest version for oracle db 21c

* fix: update to oracledb version in package.json

* fix: update lockfile

* fix: remove duplicate privileges.sql and wait-until-healthy.sh

* fix: changes to start-oracle alias

* fix: changes to start-oracle alias

* fix: changes to start-oracle alias

Co-authored-by: Sudarshan Soma <48428602+sudarshan12s@users.noreply.github.com>
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants