mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
21 lines
413 B
PL/PgSQL
21 lines
413 B
PL/PgSQL
-- +goose Up
|
|||
|
|
-- +goose StatementBegin
|
||
|
|
|
||
|
|
-- Create a common function to update the updated_at column
|
||
|
|
CREATE OR REPLACE FUNCTION update_updated_at_column()
|
||
|
|
RETURNS TRIGGER AS $$
|
||
|
|
BEGIN
|
||
|
|
NEW.updated_at = NOW();
|
||
|
|
RETURN NEW;
|
||
|
|
END;
|
||
|
|
$$ LANGUAGE plpgsql;
|
||
|
|
|
||
|
|
-- +goose StatementEnd
|
||
|
|
|
||
|
|
-- +goose Down
|
||
|
|
-- +goose StatementBegin
|
||
|
|
|
||
|
|
-- Drop the function
|
||
|
|
DROP FUNCTION IF EXISTS update_updated_at_column();
|
||
|
|
|
||
|
|
-- +goose StatementEnd
|