Skip to content
This repository was archived by the owner on Oct 5, 2021. It is now read-only.
This repository was archived by the owner on Oct 5, 2021. It is now read-only.

User token relationship .onDelete('CASCADE') to blueprint #40

@McSneaky

Description

@McSneaky

Currently when I try to delete user I get error:

ERROR: update or delete on table "users" violates foreign key constraint "tokens_user_id_foreign" on table "tokens"

I usually modify token migration to include .onDelete('CASCADE') to user and token relation in https://github.com/adonisjs/adonis-api-app/blob/master/database/migrations/1503250034280_token.js#L10

Then I don't have to worry about clearing user tokens before I delete user itself.

Perhaps it can added into blueprint(s) by default?
Or will it cause problems with some databases? 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions