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

isRequired on a field with knex adapter throws errors during back link updates #1553

Closed
jesstelford opened this issue Aug 29, 2019 · 3 comments
Assignees

Comments

@jesstelford
Copy link
Contributor

The back linking process for a to-single field uses a brute-force approach right now where it forces the linked field to null, then immediately after sets it to the id.

But if you've got isRequired set, knex will throw an error during the first phase of the back linking.

@stale
Copy link

stale bot commented Oct 28, 2019

It looks like you haven't had a response in over 3 months. Sorry about that! We've flagged this issue for special attention. It wil be manually reviewed by maintainers, not automatically closed. If you have any additional information please leave us a comment. It really helps! Thank you for you contributions. :)

@stale stale bot added the needs-review label Oct 28, 2019
@singhArmani
Copy link
Contributor

singhArmani commented Feb 5, 2020

@jesstelford @MadeByMike: While trying the following keystone config (with knex) on my macOS and with chrome browser:

const keystone = new Keystone({
  name: 'Keystone To-Do List',
  adapter: new Adapter({ dropDatabase: true }),
});

keystone.createList('Todo', {
  schemaDoc: 'A list of things which need to be done',
  fields: {
    name: { type: Text, schemaDoc: 'This is the thing you need to do', isRequired: true },
    createdBy: { type: Relationship, ref: 'User', isRequired: true },
  },
});

keystone.createList('User', {
  schemaDoc: 'user who owns the todo',
  fields: {
    name: { type: Text, isRequired: true },
  },
});

I wasn't able to reproduce this bug. It seems to be fixed.
Closing it now :)

@MadeByMike
Copy link
Contributor

Fixed by Tim \o/

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