CREATE TABLE "public"."t_crawler_book" (
  "book_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "book_name" varchar(255) COLLATE "pg_catalog"."default",
  "scheme_id" varchar(255) COLLATE "pg_catalog"."default",
  "subject_id" varchar(255) COLLATE "pg_catalog"."default",
  "stage_id" varchar(255) COLLATE "pg_catalog"."default",
  "id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL
)
;
COMMENT ON COLUMN "public"."t_crawler_book"."book_id" IS '册ID';
COMMENT ON COLUMN "public"."t_crawler_book"."book_name" IS '册的名称';
COMMENT ON COLUMN "public"."t_crawler_book"."scheme_id" IS '版本ID，比如人教版本ID,与t_crawler_scheme表中的scheme_id关联';
COMMENT ON COLUMN "public"."t_crawler_book"."subject_id" IS '科目id,与t_crawler_subject中的subject_id关联';
COMMENT ON COLUMN "public"."t_crawler_book"."stage_id" IS '学段ID，与t_crawler_stage中的stage_id关联';
COMMENT ON COLUMN "public"."t_crawler_book"."id" IS '主键，无实际意义';
COMMENT ON TABLE "public"."t_crawler_book" IS '课程章节目录中的册概念，比如三年级上册，四年级下册';

DROP TABLE IF EXISTS "public"."t_crawler_scheme";
CREATE TABLE "public"."t_crawler_scheme" (
  "scheme_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "scheme_name" varchar(255) COLLATE "pg_catalog"."default",
  "subject_id" varchar(255) COLLATE "pg_catalog"."default",
  "stage_id" varchar(255) COLLATE "pg_catalog"."default",
  "id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL
)
;
COMMENT ON COLUMN "public"."t_crawler_scheme"."scheme_id" IS '版本ID';
COMMENT ON COLUMN "public"."t_crawler_scheme"."scheme_name" IS '版本名称';
COMMENT ON COLUMN "public"."t_crawler_scheme"."subject_id" IS '学科ID';
COMMENT ON COLUMN "public"."t_crawler_scheme"."stage_id" IS '学段ID';
COMMENT ON COLUMN "public"."t_crawler_scheme"."id" IS '主键';
COMMENT ON TABLE "public"."t_crawler_scheme" IS '教材版本，目前一般一个学科一个版本';

DROP TABLE IF EXISTS "public"."t_crawler_stage";
CREATE TABLE "public"."t_crawler_stage" (
  "stage_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "stage_name" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."t_crawler_stage"."stage_id" IS '学段ID';
COMMENT ON COLUMN "public"."t_crawler_stage"."stage_name" IS '学段名称';
COMMENT ON TABLE "public"."t_crawler_stage" IS '学段表';

DROP TABLE IF EXISTS "public"."t_crawler_subject";
CREATE TABLE "public"."t_crawler_subject" (
  "subject_id" varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
  "subject_name" varchar(255) COLLATE "pg_catalog"."default",
  "stage_id" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."t_crawler_subject"."subject_id" IS '科目ID';
COMMENT ON COLUMN "public"."t_crawler_subject"."subject_name" IS '科目名称';
COMMENT ON COLUMN "public"."t_crawler_subject"."stage_id" IS '学段ID';
COMMENT ON TABLE "public"."t_crawler_subject" IS '学科表';

ALTER TABLE "public"."t_crawler_book" ADD CONSTRAINT "t_crawler_booke_pkey" PRIMARY KEY ("id");

ALTER TABLE "public"."t_crawler_scheme" ADD CONSTRAINT "t_crawler_scheme_pkey" PRIMARY KEY ("id");


ALTER TABLE "public"."t_crawler_subject" ADD CONSTRAINT "t_crawler_subject_pkey" PRIMARY KEY ("subject_id");
