sql-migrate icon indicating copy to clipboard operation
sql-migrate copied to clipboard

create function in the migration file

Open daddycarbone opened this issue 5 years ago • 0 comments

i am trying to create the function in .sql file here is my syntax

-- +migrate Up
CREATE OR REPLACE FUNCTION trigger_set_timestamp()
    RETURNS TRIGGER AS $$
BEGIN
    NEW.updated_at = NOW();
    RETURN NEW;
END;
$$

i was trying using -- +migrate StatementBegin and End but it said not matching

is there any way to create a function with sql-migrate?

daddycarbone avatar Jun 01 '20 00:06 daddycarbone