CREATE TABLE IF NOT EXISTS static_struct
(
    id          UUID PRIMARY KEY,
    analysis_id UUID         NOT NULL REFERENCES static_analysis (id) ON DELETE CASCADE,
    name        VARCHAR(500) NOT NULL,
    size        INTEGER      NOT NULL DEFAULT 0,
    is_union    BOOLEAN      NOT NULL DEFAULT FALSE,
    members     TEXT         NOT NULL DEFAULT ''
);

CREATE INDEX IF NOT EXISTS idx_static_struct_analysis_id ON static_struct (analysis_id);

CREATE TABLE IF NOT EXISTS static_enum
(
    id          UUID PRIMARY KEY,
    analysis_id UUID         NOT NULL REFERENCES static_analysis (id) ON DELETE CASCADE,
    name        VARCHAR(500) NOT NULL,
    width       INTEGER      NOT NULL DEFAULT 0,
    constants   TEXT         NOT NULL DEFAULT ''
);

CREATE INDEX IF NOT EXISTS idx_static_enum_analysis_id ON static_enum (analysis_id);
