create table devices (
    id integer primary key not null,

    device_id text not null,
    user_id bigint not null
        references users (id)
        on delete cascade,

    caption text not null,
    type text not null,

    unique (user_id, device_id)
);
