Files
koc-loop/drizzle/0000_pink_iron_monger.sql

72 lines
2.2 KiB
MySQL
Raw Permalink Normal View History

2026-07-30 12:06:41 +08:00
CREATE TABLE `accounts` (
`id` text PRIMARY KEY NOT NULL,
`platform` text DEFAULT '小红书' NOT NULL,
`platform_uid` text NOT NULL,
`nickname` text NOT NULL,
`profile_url` text DEFAULT '' NOT NULL,
`ip_location` text DEFAULT '待识别' NOT NULL,
`followers` integer DEFAULT 0 NOT NULL,
`post_count` integer DEFAULT 0 NOT NULL,
`avg_views` integer DEFAULT 0 NOT NULL,
`first_seen_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
`last_seen_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `accounts_platform_uid_idx` ON `accounts` (`platform`,`platform_uid`);--> statement-breakpoint
CREATE TABLE `contents` (
`id` text PRIMARY KEY NOT NULL,
`task_id` text NOT NULL,
`title` text NOT NULL,
`body` text DEFAULT '' NOT NULL,
`status` text DEFAULT 'available' NOT NULL,
`source` text DEFAULT '飞书内容表' NOT NULL,
`created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL
);
--> statement-breakpoint
CREATE TABLE `distributions` (
`id` text PRIMARY KEY NOT NULL,
`task_id` text NOT NULL,
`content_id` text NOT NULL,
`partner_id` text NOT NULL,
`account_id` text,
`publish_url` text,
`publish_time` text,
`status` text DEFAULT 'claimed' NOT NULL,
`claimed_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL,
`screenshot_key` text,
`ocr_status` text DEFAULT 'none' NOT NULL,
`exposure` integer,
`views` integer,
`d2_likes` integer,
`d2_comments` integer,
`d2_collects` integer,
`d5_likes` integer,
`d5_comments` integer,
`d5_collects` integer,
`d7_likes` integer,
`d7_comments` integer,
`d7_collects` integer,
`updated_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL
);
--> statement-breakpoint
CREATE TABLE `partners` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL,
`wecom_name` text NOT NULL,
`owner` text DEFAULT '运营组' NOT NULL,
`claimed_total` integer DEFAULT 0 NOT NULL,
`completed_total` integer DEFAULT 0 NOT NULL,
`created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL
);
--> statement-breakpoint
CREATE TABLE `tasks` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL,
`brand` text NOT NULL,
`quantity` integer NOT NULL,
`claimed_quantity` integer DEFAULT 0 NOT NULL,
`due_at` text NOT NULL,
`status` text DEFAULT 'active' NOT NULL,
`created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL
);