create table credentials
(
    id                bigint generated by default as identity primary key,
    name              text        not null,
    type              text        not null check (type in ('ssh_password', 'winrm_password')),
    username          text        not null,
    secret_ciphertext bytea       not null,
    secret_nonce      bytea       not null,
    created_by        bigint,
    created_at        timestamptz not null default now(),
    updated_at        timestamptz not null default now(),
    deleted_at        timestamptz
);

create index credentials_type_idx on credentials (type) where deleted_at is null;
create unique index credentials_name_unique_idx on credentials (name) where deleted_at is null;
