-- +goose Up
-- +goose StatementBegin
CREATE TABLE users (
  id integer primary key not null,
  email varchar not null unique,
  password varchar not null,
  created_at datetime default current_timestamp,
  updated_at datetime default current_timestamp
);

CREATE TRIGGER update_users_updated_at
AFTER UPDATE ON users
FOR EACH ROW
  BEGIN
    UPDATE users
    SET updated_at = current_timestamp
    WHERE id = OLD.id;
  END;
-- +goose StatementEnd

-- +goose Down
-- +goose StatementBegin
DROP TABLE users;
-- +goose StatementEnd
		
