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

Model instance delete() function defaults to "id" primary key column name #51

Closed
dblarsen opened this issue Sep 27, 2016 · 1 comment
Closed
Assignees

Comments

@dblarsen
Copy link

Using AdonisJS 3.0

I defined an Employee class:
class Employee extends Lucid {

static get primaryKey () {
    return **'employee_id';**
} 

[...]

In my EmployeeController class destroy function
[...]
const employee = yield Employee.find(2); // hard-coded ID for test
yield employee.delete();
[...]

Sqlite3 debug statement:
{ method: 'update',
options: {},
bindings: [ '2016-09-27 00:15:46', '2016-09-27 00:15:46', 2 ],
sql: 'update "employees" set "deleted_at" = ?, "updated_at" = ? where "id" = ?' }

@thetutlage thetutlage self-assigned this Sep 27, 2016
@thetutlage thetutlage added the bug label Sep 27, 2016
@thetutlage
Copy link
Member

Released as 3.0.6

thetutlage added a commit that referenced this issue Jul 16, 2017
model instance operations should use primary key value instead of hardcoded id

Closes #51
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

2 participants