schema.sql 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. create table if not exists emails (
  2. id bigint auto_increment primary key,
  3. email varchar(128) not null,
  4. user_id bigint default null,
  5. is_spammer bool not null default false,
  6. is_banned bool not null default false,
  7. banned_at datetime default NULL,
  8. ban_reason varchar(2048) default NULL,
  9. unique(email)
  10. );
  11. create table if not exists users (
  12. id bigint auto_increment primary key,
  13. user_hash varchar(128) not null,
  14. display_name varchar(32) not null,
  15. chirp_count int not null default 0,
  16. primary_email varchar(128) not null,
  17. joined_at datetime not null default now(),
  18. permissions varchar(1024) not null default '',
  19. pwd_hash varchar(256) not null,
  20. pwd_salt varchar(256) not null,
  21. is_banned bool not null default false,
  22. reset_token varchar(32) default NULL,
  23. unique (display_name)
  24. );
  25. create table if not exists ignores (
  26. ignoror bigint not null,
  27. ignoree bigint not null,
  28. primary key (ignoror, ignoree)
  29. );
  30. create table if not exists chirps (
  31. id bigint auto_increment primary key,
  32. created_by bigint not null,
  33. created_at datetime not null default now(),
  34. content varchar(256) not null,
  35. reply_of bigint default null
  36. );