gpt4 book ai didi

mysql - 如果我想用 "reactions"做一个类似于 facebook 的数据库,这种架构有意义吗?

转载 作者:行者123 更新时间:2023-11-29 07:18:40 27 4
gpt4 key购买 nike

<分区>

我正在尝试了解以下设计对于 facebook react 之类的内容是否有意义。我的想法是,每个 react 最终都会是一个 user_ids 列表。例子:reaction_like =[19,24,36,75][19,24,36,75] 是人们的用户 ID

CREATE TABLE users (
user_id BIGINT(20) unsigned NOT NULL auto_increment,
user_name varchar(255) NOT NULL UNIQUE,
first_name varchar(255) NOT NULL,
last_name varchar(255) NOT NULL,
phone_number varchar(255) NOT NULL UNIQUE,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(user_id)
) ENGINE = InnoDB;

CREATE TABLE posts (
user_id BIGINT(20) unsigned NOT NULL auto_increment,
post_id BIGINT(20) unsigned NOT NULL auto_increment,
post_text varchar(255) NOT NULL,
reaction_happy BIGINT(20) unsigned NOT NULL auto_increment
reaction_sad BIGINT(20) unsigned NOT NULL auto_increment
reaction_surprised BIGINT(20) unsigned NOT NULL auto_increment
reaction_like BIGINT(20) unsigned NOT NULL auto_increment
PRIMARY KEY (post_id)
)

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com