xhs_server/db_struct.md
2024-12-16 10:31:07 +08:00

3.2 KiB

小红书数据库表结构

xhs_notes

CREATE TABLE `xhs_notes` (
	`id` INT NOT NULL AUTO_INCREMENT,
	`note_id` VARCHAR(50) NOT NULL COLLATE 'utf8mb4_unicode_ci',
	`type` VARCHAR(20) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`title` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`description` TEXT NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`video_url` TEXT NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`time` BIGINT NULL DEFAULT NULL,
	`last_update_time` BIGINT NULL DEFAULT NULL,
	`user_id` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`nickname` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`avatar` TEXT NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`liked_count` VARCHAR(20) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`collected_count` VARCHAR(20) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`comment_count` VARCHAR(20) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`share_count` VARCHAR(20) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`ip_location` VARCHAR(100) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`image_list` TEXT NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`tag_list` TEXT NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`last_modify_ts` BIGINT NULL DEFAULT NULL,
	`note_url` TEXT NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`source_keyword` VARCHAR(50) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`created_at` TIMESTAMP NULL DEFAULT (CURRENT_TIMESTAMP),
	`download_flag` TINYINT NULL DEFAULT '0',
	`sheet_name` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	PRIMARY KEY (`id`) USING BTREE,
	UNIQUE INDEX `note_id` (`note_id`) USING BTREE
)

clean_note_store

CREATE TABLE `clean_note_store` (
	`id` INT NOT NULL AUTO_INCREMENT,
	`note_id` INT NULL DEFAULT NULL,
	`content_type` ENUM('guide','mindmap','summary') NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`content` TEXT NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`content_hash` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`vector_id` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`recall_times` INT NULL DEFAULT '0',
	`created_at` TIMESTAMP NULL DEFAULT (CURRENT_TIMESTAMP),
	PRIMARY KEY (`id`) USING BTREE,
	INDEX `idx_note_id` (`note_id`) USING BTREE,
	INDEX `idx_content_hash` (`content_hash`) USING BTREE,
	INDEX `idx_content_type` (`content_type`) USING BTREE,
	CONSTRAINT `fk_clean_note_store_note_id` FOREIGN KEY (`note_id`) REFERENCES `xhs_notes` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION
)
COLLATE='utf8mb4_unicode_ci'
ENGINE=InnoDB
AUTO_INCREMENT=1453
;

vector_store

CREATE TABLE `vector_store` (
	`id` INT NOT NULL AUTO_INCREMENT,
	`note_id` INT NULL DEFAULT NULL,
	`vector_id` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`content` LONGTEXT NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	`recall_times` INT NULL DEFAULT NULL,
	`content_hash` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_unicode_ci',
	PRIMARY KEY (`id`) USING BTREE,
	INDEX `idx_note_id` (`note_id`) USING BTREE,
	CONSTRAINT `fk_note_id` FOREIGN KEY (`note_id`) REFERENCES `xhs_notes` (`id`) ON UPDATE NO ACTION ON DELETE NO ACTION
)
COLLATE='utf8mb4_unicode_ci'
ENGINE=InnoDB
AUTO_INCREMENT=2591
;