create table telegram_posts (
                                  id number(19),
                                  public_id number(19) not null references telegram_publics(id),
                                  user_id number(19) not null references users(id),
                                  state varchar2(255) not null,

                                  "type" varchar2(255) not null,
                                  "text" varchar2(2000) not null,
                                  file_id varchar2(255) references files(id),

                                  created_at timestamp with time zone not null,
                                  updated_at timestamp with time zone not null,
                                  sent_at timestamp with time zone
);

CREATE SEQUENCE telegram_posts_id_seq;

create index telegram_posts_public_ix on telegram_posts(public_id, created_at desc);
