Skip to content

Database - Create Trigger #372

@Brianelvio

Description

@Brianelvio

Describe the bug
When trying to create a trigger the migration will always fail.

My attempt:

CREATE TRIGGER update_users_timestamp 
AFTER UPDATE ON users
BEGIN
  UPDATE users SET updated_at = CURRENT_TIMESTAMP WHERE id = NEW.id;
END;

Error:

 ERROR  Failed to apply migration ./server/database/migrations/0002_adduserstimestamptrigger.sql
 D1_ERROR: incomplete input: SQLITE_ERROR

Steps to reproduce
Steps to reproduce the behavior:

  1. Create a migration
  2. Try to create a trigger
  3. Run the migration
  4. See error

Expected behavior
Migration is able to handle triggers for SQLite.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions