zadmin/db/migrations/20241214133322_add_agent_table.sql
2024-12-14 14:44:37 +01:00

18 lines
419 B
SQL

-- +goose Up
-- +goose StatementBegin
CREATE TABLE agent (
id UUID NOT NULL DEFAULT generate_ulid(),
machine_id UUID NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(id),
FOREIGN KEY (machine_id) REFERENCES machine(id)
);
CREATE INDEX idx_agent_machine_id ON agent(machine_id);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE agent;
-- +goose StatementEnd