-- +goose Up -- +goose StatementBegin CREATE TABLE images ( id varchar primary key not null, data blob not null, user_id integer not null, created_at datetime default current_timestamp, updated_at datetime default current_timestamp, FOREIGN KEY(user_id) REFERENCES users(id) ); CREATE TRIGGER update_images_updated_at AFTER UPDATE ON images FOR EACH ROW BEGIN UPDATE images SET updated_at = current_timestamp WHERE id = OLD.id; END; -- +goose StatementEnd -- +goose Down -- +goose StatementBegin DROP TABLE images; -- +goose StatementEnd