Skip to content

Cannot insert data when the id of the table is not named id in the database #474

Description

@tomiy

Describe the bug
Cannot insert data when the id of the table is not named id in the database (at least using mssql)

To Reproduce
Steps to reproduce the behavior:

  1. Create any table with an id named something other than id (id_table for instance)
  2. perform an insert with repo.insert(obj)
  3. An error will be raised stating something about the id column not existing (which it doesn't)

Expected behavior
I can insert data into my database

Desktop (please complete the following information):

  • OS: Windows 11
  • Browser: Firefox
  • Version: latest

Additional context
There seems to be hardcoded id keys here and here
Changing both of these lines to respectively dbName instead of key and result[0][this.entity.idMetadata.field.dbName] instead of result[0].id seems to have fixed the problem locally for me, but I couldn't dig deeper to check all cases due to time constraints
This may or may not be local to mssql, tedious & knex

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions