graphile / crystal-pre-merge

Repository moved
https://github.com/graphile/crystal
39 stars 10 forks source link

Enums doc page is wrong when only using the amber preset #467

Open benjie opened 11 months ago

benjie commented 11 months ago

@enum smart comment not enough on its own.

Context: https://discord.com/channels/489127045289476126/498852330754801666/1139285394274402335

Reported by @sgrove

Reproduction SQL:

CREATE TABLE chain_trace_status (
    status TEXT PRIMARY KEY,
    description TEXT
);
COMMENT ON TABLE chain_trace_status IS E'@enum\n@enumName ChainTraceStatus';

INSERT INTO chain_trace_status (status, description) VALUES
    ('PENDING', 'Chain trace is pending'),
    ('IN_PROGRESS', 'Chain trace is in progress'),
    ('SUCCESS', 'Chain trace has finished successfully'),
    ('ERROR', 'Chain trace has finished with errors');

CREATE TABLE chain_trace (
    id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
    chain_id UUID REFERENCES chain(id) ON DELETE CASCADE,
    status TEXT NOT NULL REFERENCES chain_trace_status(status) ON DELETE RESTRICT
);

I thought that issuing this:

COMMENT ON TABLE chain_trace_status IS E'@behavior enum\n@enumName ChainTraceStatus';

should fix it; but apparently it doesn't.