PowerSync Triggers and Views

alister's profile image alister posted 4 months ago in General Permalink

I'm working on a project that uses PowerSync (an external constraint) and it relies on Triggers in SQLite that HeidiSQL doesn't seem to like, for instance:

CREATE TRIGGER ABV_delete
after delete on ABV
for each row
begin
  insert into powersync_crud(op,id,type) VALUES ('DELETE', OLD.UUID, 'ABV');
end

For some reason HeidiSQL throws an exception when trying to view this, it views fine in DB Browser for SQLite where is where I have copied it from.

ansgar's profile image ansgar posted 4 months ago Permalink

I suppose you mean the "SQL error: near SHOW: syntax error" popup. Yes, this is caused by HeidiSQL's yet incomplete support for editing triggers in SQLite. Behind the scenes, HeidiSQL is reading trigger details through a MySQL-only query. Creating new triggers is not a problem, but altering existing ones is.

I just created issue #2254 for that purpose.

ansgar's profile image ansgar posted 4 months ago Permalink

New HeidiSQL builds now support editing triggers on SQLite.

Please login to leave a reply, or register at first.