jackc / jackc/tern

What is best strategy to create trigger?

Open
#20 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.3k
Forks
86
PR merge metrics
No merged PRs in 30d

Description

Hello,
What is best strategy to create trigger?
I'm trying to create trigger in same migration file where create table is:

```
-- This is a sample migration.
create table people(
id serial primary key,
first_name varchar not null,
last_name varchar not null,
created_at timestamp without time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at timestamp without time zone,
);

CREATE TRIGGER set_update_timestamp
BEFORE UPDATE
ON people
FOR EACH ROW
EXECUTE PROCEDURE trigger_set_timestamp();

---- create above / drop below ----

drop table people;
```

I got error:
ERROR: syntax error at or near ")" (SQLSTATE 42601)
LINE 9: )
^

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the migration shown in the issue and inspect how Tern handles the create-table and trigger statements in the same migration. Check the PostgreSQL error location and the migration's up/down sections first; done means documenting or validating the supported strategy for creating and removing a trigger.

Written by the indexing model from the issue text.

Assessment

Tech stack
sql
Domain
databases, tooling
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.