Personal blog written from scratch using Node.js, Bootstrap, and MySQL. https://jrtechs.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.3 KiB

  1. # MYSQL Schema
  2. ![](docs/blogSql.svg)
  3. ```mysql
  4. create database jrtechs_blog;
  5. use jrtechs_blog;
  6. create table users(
  7. user_id mediumint unsigned not null AUTO_INCREMENT,
  8. user_name varchar(60) not null,
  9. password char(64) not null,
  10. salt char(64) not null,
  11. primary key(user_id)
  12. );
  13. create table categories(
  14. category_id mediumint unsigned not null AUTO_INCREMENT,
  15. name varchar(60) not null,
  16. url varchar(60) not null,
  17. primary key(category_id)
  18. );
  19. create table posts(
  20. post_id mediumint unsigned not null AUTO_INCREMENT,
  21. category_id mediumint unsigned not null,
  22. picture_url varchar(100) not null,
  23. published datetime not null,
  24. name varchar(100) not null,
  25. url varchar(100) not null,
  26. pinned BIT,
  27. primary key(post_id)
  28. );
  29. ALTER TABLE posts ADD pinned BIT;
  30. create table downloads(
  31. download_id mediumint unsigned not null AUTO_INCREMENT,
  32. file varchar(40) not null,
  33. name varchar(40) not null,
  34. download_count mediumint not null,
  35. primary key(download_id)
  36. );
  37. create table popular_posts(
  38. popular_post_id mediumint unsigned not null AUTO_INCREMENT,
  39. post_id mediumint unsigned not null,
  40. primary key(popular_post_id)
  41. );
  42. create table traffic_log(
  43. log_id mediumint unsigned not null AUTO_INCREMENT,
  44. url varchar(60) not null,
  45. ip varchar(20) not null,
  46. date datetime not null,
  47. primary key(log_id)
  48. );
  49. grant all on jrtechs_blog.* to blog_user@localhost identified by "password";
  50. ```