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

Pivot table timestamp #84

Closed
manoj-manoharan-backup-old opened this issue Jan 5, 2017 · 3 comments
Closed

Pivot table timestamp #84

manoj-manoharan-backup-old opened this issue Jan 5, 2017 · 3 comments
Assignees

Comments

@manoj-manoharan-backup-old
Copy link

manoj-manoharan-backup-old commented Jan 5, 2017

While using relationship in tables time stamp are not maintained in pivot table, it remains empty while creating or updating records.

@thetutlage
Copy link
Member

Added the support for withTimestamps to respect pivot table timestamps

How to use

class Student extends Model {
    courses () {
        return this.belongsToMany(Course).withTimestamps()
    }
}

For now you need to install adonis-lucid from github. Will let you know when it is released on npm

@thetutlage thetutlage self-assigned this Jan 5, 2017
@RomainLanz
Copy link
Member

RomainLanz commented Jan 5, 2017

Why not call it withPivot() in case you get more fields than only timestamps?

@thetutlage
Copy link
Member

withPivot is already there to manually select fields http://adonisjs.com/docs/3.2/relationships#_withpivot_keys

thetutlage added a commit that referenced this issue Jul 16, 2017
now withTimestamps will respect timestamps in pivot table

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