当前位置:网站首页>Microservice Project Construction II: database design
Microservice Project Construction II: database design
2022-06-13 08:14:00 【Dreams Of blue】
01, Basic personnel information and authority design
2, Course related database design
Database table information is :
Create database , The name is : course
One , Create sequence
create sequence base_case_questions_seq increment by 1 minvalue 1 no maxvalue start with 1;
create sequence base_examination_site_seq increment by 1 minvalue 1 no maxvalue start with 1;
create sequence base_multiple_choice_seq increment by 1 minvalue 1 no maxvalue start with 1;
create sequence base_profession_seq increment by 1 minvalue 1 no maxvalue start with 1;
create sequence base_rank_seq increment by 1 minvalue 1 no maxvalue start with 1;
create sequence base_subject_year_seq increment by 1 minvalue 1 no maxvalue start with 1;
create sequence base_thesis_title_seq increment by 1 minvalue 1 no maxvalue start with 1;
create sequence rel_examination_questions_seq increment by 1 minvalue 1 no maxvalue start with 1;
Two , Create table
Create a case table :base_case_questions
-- ----------------------------
-- Table structure for base_case_questions
-- ----------------------------
DROP TABLE IF EXISTS "public"."base_case_questions";
CREATE TABLE "public"."base_case_questions" (
"id" int4 NOT NULL DEFAULT nextval('base_case_questions_seq'::regclass),
"serial_number" int4,
"content" text COLLATE "pg_catalog"."default",
"delete_status" int2 DEFAULT 0,
"create_time" varchar(255) COLLATE "pg_catalog"."default",
"update_time" varchar(255) COLLATE "pg_catalog"."default",
"create_id" int4,
"update_id" int4,
"subject_year_id" int4,
"question_one" varchar(255) COLLATE "pg_catalog"."default",
"question_one_url" varchar(255) COLLATE "pg_catalog"."default",
"question_two" varchar(255) COLLATE "pg_catalog"."default",
"question_two_url" varchar(255) COLLATE "pg_catalog"."default",
"question_three" varchar(255) COLLATE "pg_catalog"."default",
"question_three_url" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."base_case_questions"."id" IS ' Primary key id';
COMMENT ON COLUMN "public"."base_case_questions"."serial_number" IS ' Title No , Indicates the number of questions ';
COMMENT ON COLUMN "public"."base_case_questions"."content" IS ' The main content of the topic ';
COMMENT ON COLUMN "public"."base_case_questions"."delete_status" IS ' Delete status (0 Identity not deleted ,1 Indicates that )';
COMMENT ON COLUMN "public"."base_case_questions"."create_time" IS ' Creation time ';
COMMENT ON COLUMN "public"."base_case_questions"."update_time" IS ' Modification time ';
COMMENT ON COLUMN "public"."base_case_questions"."create_id" IS ' Create human id';
COMMENT ON COLUMN "public"."base_case_questions"."update_id" IS ' Modify the person's id';
COMMENT ON COLUMN "public"."base_case_questions"."subject_year_id" IS ' Course year id';
COMMENT ON COLUMN "public"."base_case_questions"."question_one" IS ' Content of question 1 ';
COMMENT ON COLUMN "public"."base_case_questions"."question_one_url" IS ' Picture of question one url';
COMMENT ON COLUMN "public"."base_case_questions"."question_two" IS ' Content of question 2 ';
COMMENT ON COLUMN "public"."base_case_questions"."question_two_url" IS ' Picture of question 2 url';
COMMENT ON COLUMN "public"."base_case_questions"."question_three" IS ' Question 3 ';
COMMENT ON COLUMN "public"."base_case_questions"."question_three_url" IS ' Picture of question 3 url';
COMMENT ON TABLE "public"."base_case_questions" IS ' List of case questions ';
-- ----------------------------
-- Records of base_case_questions
-- ----------------------------
-- ----------------------------
-- Primary Key structure for table base_case_questions
-- ----------------------------
ALTER TABLE "public"."base_case_questions" ADD CONSTRAINT "base_case_questions_pkey" PRIMARY KEY ("id");
Create a test site table :base_examination_site
-- ----------------------------
-- Table structure for base_examination_site
-- ----------------------------
DROP TABLE IF EXISTS "public"."base_examination_site";
CREATE TABLE "public"."base_examination_site" (
"id" int4 NOT NULL DEFAULT nextval('base_examination_site_seq'::regclass),
"name" varchar(255) COLLATE "pg_catalog"."default",
"delete_status" int2 DEFAULT 0,
"create_time" varchar(255) COLLATE "pg_catalog"."default",
"update_time" varchar(255) COLLATE "pg_catalog"."default",
"create_id" int4,
"update_id" int4,
"video_url" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."base_examination_site"."id" IS ' Primary key id';
COMMENT ON COLUMN "public"."base_examination_site"."name" IS ' Description of the test site ';
COMMENT ON COLUMN "public"."base_examination_site"."delete_status" IS ' Delete status (0 Identity not deleted ,1 Indicates that )';
COMMENT ON COLUMN "public"."base_examination_site"."create_time" IS ' Creation time ';
COMMENT ON COLUMN "public"."base_examination_site"."update_time" IS ' Modification time ';
COMMENT ON COLUMN "public"."base_examination_site"."create_id" IS ' Create human id';
COMMENT ON COLUMN "public"."base_examination_site"."update_id" IS ' Modify the person's id';
COMMENT ON COLUMN "public"."base_examination_site"."video_url" IS ' Associated video description url';
COMMENT ON TABLE "public"."base_examination_site" IS ' Examination site table ';
-- ----------------------------
-- Records of base_examination_site
-- ----------------------------
-- ----------------------------
-- Primary Key structure for table base_examination_site
-- ----------------------------
ALTER TABLE "public"."base_examination_site" ADD CONSTRAINT "base_examination_site_pkey" PRIMARY KEY ("id");
Create a multiple choice table :base_multiple_choice
-- ----------------------------
-- Table structure for base_multiple_choice
-- ----------------------------
DROP TABLE IF EXISTS "public"."base_multiple_choice";
CREATE TABLE "public"."base_multiple_choice" (
"id" int4 NOT NULL DEFAULT nextval('base_multiple_choice_seq'::regclass),
"serial_number" int4,
"content" text COLLATE "pg_catalog"."default",
"answer" varchar(255) COLLATE "pg_catalog"."default",
"type" int2 DEFAULT 1,
"a_choice" varchar(255) COLLATE "pg_catalog"."default",
"b_choice" varchar(255) COLLATE "pg_catalog"."default",
"c_choice" varchar(255) COLLATE "pg_catalog"."default",
"d_choice" varchar(255) COLLATE "pg_catalog"."default",
"image_url" varchar(255) COLLATE "pg_catalog"."default",
"delete_status" int2 DEFAULT 0,
"create_time" varchar(255) COLLATE "pg_catalog"."default",
"update_time" varchar(255) COLLATE "pg_catalog"."default",
"create_id" int4,
"update_id" int4,
"subject_year_id" int4
)
;
COMMENT ON COLUMN "public"."base_multiple_choice"."id" IS ' The primary key of the title table id';
COMMENT ON COLUMN "public"."base_multiple_choice"."serial_number" IS ' Title No , Indicates the number of questions ';
COMMENT ON COLUMN "public"."base_multiple_choice"."content" IS ' Content ';
COMMENT ON COLUMN "public"."base_multiple_choice"."answer" IS ' answer (A,B,C,D) To choose from ';
COMMENT ON COLUMN "public"."base_multiple_choice"."type" IS ' Is there a picture (1 Indicates no picture ,2 It means there are pictures )';
COMMENT ON COLUMN "public"."base_multiple_choice"."a_choice" IS ' Options a The content of ';
COMMENT ON COLUMN "public"."base_multiple_choice"."b_choice" IS ' Options b The content of ';
COMMENT ON COLUMN "public"."base_multiple_choice"."c_choice" IS ' Options c The content of ';
COMMENT ON COLUMN "public"."base_multiple_choice"."d_choice" IS ' Options d The content of ';
COMMENT ON COLUMN "public"."base_multiple_choice"."image_url" IS ' Picture storage url';
COMMENT ON COLUMN "public"."base_multiple_choice"."delete_status" IS ' Delete status (0 Identity not deleted ,1 Indicates that )';
COMMENT ON COLUMN "public"."base_multiple_choice"."create_time" IS ' Creation time ';
COMMENT ON COLUMN "public"."base_multiple_choice"."update_time" IS ' Modification time ';
COMMENT ON COLUMN "public"."base_multiple_choice"."create_id" IS ' Create human id';
COMMENT ON COLUMN "public"."base_multiple_choice"."update_id" IS ' Modify the person's id';
COMMENT ON COLUMN "public"."base_multiple_choice"."subject_year_id" IS ' Course year id';
COMMENT ON TABLE "public"."base_multiple_choice" IS ' Multiple choice table ';
-- ----------------------------
-- Records of base_multiple_choice
-- ----------------------------
-- ----------------------------
-- Primary Key structure for table base_multiple_choice
-- ----------------------------
ALTER TABLE "public"."base_multiple_choice" ADD CONSTRAINT "base_subject_pkey" PRIMARY KEY ("id");
Create a career table :base_profession
-- ----------------------------
-- Table structure for base_profession
-- ----------------------------
DROP TABLE IF EXISTS "public"."base_profession";
CREATE TABLE "public"."base_profession" (
"id" int4 NOT NULL DEFAULT nextval('base_profession_seq'::regclass),
" professional_name" varchar(255) COLLATE "pg_catalog"."default",
"delete_status" int2 DEFAULT 0,
"create_time" varchar(255) COLLATE "pg_catalog"."default",
"update_time" varchar(255) COLLATE "pg_catalog"."default",
"create_id" int4,
"update_id" int4
)
;
COMMENT ON COLUMN "public"."base_profession"."id" IS ' occupation id';
COMMENT ON COLUMN "public"."base_profession"." professional_name" IS ' Professional name ';
COMMENT ON COLUMN "public"."base_profession"."delete_status" IS ' Delete status (0 Identity not deleted ,1 Indicates that )';
COMMENT ON COLUMN "public"."base_profession"."create_time" IS ' Creation time ';
COMMENT ON COLUMN "public"."base_profession"."update_time" IS ' Modification time ';
COMMENT ON COLUMN "public"."base_profession"."create_id" IS ' Create human id';
COMMENT ON COLUMN "public"."base_profession"."update_id" IS ' Modify the person's id';
COMMENT ON TABLE "public"."base_profession" IS ' Occupation table ';
-- ----------------------------
-- Records of base_profession
-- ----------------------------
INSERT INTO "public"."base_profession" VALUES (1, ' Software engineer ', 0, NULL, NULL, NULL, NULL);
-- ----------------------------
-- Primary Key structure for table base_profession
-- ----------------------------
ALTER TABLE "public"."base_profession" ADD CONSTRAINT "base_profession_info_pkey" PRIMARY KEY ("id");
Create a career grade table :base_rank
-- ----------------------------
-- Table structure for base_rank
-- ----------------------------
DROP TABLE IF EXISTS "public"."base_rank";
CREATE TABLE "public"."base_rank" (
"id" int4 NOT NULL DEFAULT nextval('base_rank_seq'::regclass),
"name" varchar(255) COLLATE "pg_catalog"."default",
"profession_id" int4,
"delete_status" int2 DEFAULT 0,
"create_time" varchar(255) COLLATE "pg_catalog"."default",
"update_time" varchar(255) COLLATE "pg_catalog"."default",
"create_id" int4,
"update_id" int4,
"level" varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT ON COLUMN "public"."base_rank"."id" IS ' Primary key id';
COMMENT ON COLUMN "public"."base_rank"."name" IS ' Rank noun ';
COMMENT ON COLUMN "public"."base_rank"."profession_id" IS ' occupation id';
COMMENT ON COLUMN "public"."base_rank"."delete_status" IS ' Delete status (0 Identity not deleted ,1 Indicates that )';
COMMENT ON COLUMN "public"."base_rank"."create_time" IS ' Creation time ';
COMMENT ON COLUMN "public"."base_rank"."update_time" IS ' Modification time ';
COMMENT ON COLUMN "public"."base_rank"."create_id" IS ' Create human id';
COMMENT ON COLUMN "public"."base_rank"."update_id" IS ' Modify the person's id';
COMMENT ON COLUMN "public"."base_rank"."level" IS ' Level ( primary , ultimate , senior , No class )';
COMMENT ON TABLE "public"."base_rank" IS ' Occupational grade table ';
-- ----------------------------
-- Records of base_rank
-- ----------------------------
INSERT INTO "public"."base_rank" VALUES (1, ' system architect ', 1, 0, NULL, NULL, NULL, NULL, ' senior ');
-- ----------------------------
-- Primary Key structure for table base_rank
-- ----------------------------
ALTER TABLE "public"."base_rank" ADD CONSTRAINT "base_rank_pkey" PRIMARY KEY ("id");
Create a year table associated with occupation level :base_subject_year
-- ----------------------------
-- Table structure for base_subject_year
-- ----------------------------
DROP TABLE IF EXISTS "public"."base_subject_year";
CREATE TABLE "public"."base_subject_year" (
"id" int4 NOT NULL DEFAULT nextval('base_subject_year_seq'::regclass),
"rank_id" int4,
"year" int4,
"type" varchar(255) COLLATE "pg_catalog"."default",
"delete_status" int2 DEFAULT 0,
"create_time" varchar(255) COLLATE "pg_catalog"."default",
"update_time" varchar(255) COLLATE "pg_catalog"."default",
"create_id" int4,
"update_id" int4
)
;
COMMENT ON COLUMN "public"."base_subject_year"."id" IS ' Primary key id';
COMMENT ON COLUMN "public"."base_subject_year"."rank_id" IS ' Rank table id';
COMMENT ON COLUMN "public"."base_subject_year"."year" IS ' year ';
COMMENT ON COLUMN "public"."base_subject_year"."type" IS '( On , Next )';
COMMENT ON COLUMN "public"."base_subject_year"."delete_status" IS ' Delete status (0 Identity not deleted ,1 Indicates that )';
COMMENT ON COLUMN "public"."base_subject_year"."create_time" IS ' Creation time ';
COMMENT ON COLUMN "public"."base_subject_year"."update_time" IS ' Modification time ';
COMMENT ON COLUMN "public"."base_subject_year"."create_id" IS ' Create human id';
COMMENT ON COLUMN "public"."base_subject_year"."update_id" IS ' Modify the person's id';
-- ----------------------------
-- Records of base_subject_year
-- ----------------------------
INSERT INTO "public"."base_subject_year" VALUES (1, 1, 2010, ' Next ', 0, NULL, NULL, NULL, NULL);
-- ----------------------------
-- Primary Key structure for table base_subject_year
-- ----------------------------
ALTER TABLE "public"."base_subject_year" ADD CONSTRAINT "base_subject_year_pkey" PRIMARY KEY ("id");
Create a paper title table :base_thesis_title
-- ----------------------------
-- Table structure for base_thesis_title
-- ----------------------------
DROP TABLE IF EXISTS "public"."base_thesis_title";
CREATE TABLE "public"."base_thesis_title" (
"id" int4 DEFAULT nextval('base_thesis_title_seq'::regclass),
"content" text COLLATE "pg_catalog"."default",
"question_one" text COLLATE "pg_catalog"."default",
"delete_status" int2 DEFAULT 0,
"create_time" varchar(255) COLLATE "pg_catalog"."default",
"update_time" varchar(255) COLLATE "pg_catalog"."default",
"create_id" int4,
"update_id" int4,
"subject_year_id" int4
)
;
COMMENT ON COLUMN "public"."base_thesis_title"."id" IS ' Primary key id';
COMMENT ON COLUMN "public"."base_thesis_title"."content" IS ' Topic content ';
COMMENT ON COLUMN "public"."base_thesis_title"."question_one" IS ' problem 1 Content ';
COMMENT ON COLUMN "public"."base_thesis_title"."delete_status" IS ' Delete status (0 Identity not deleted ,1 Indicates that )';
COMMENT ON COLUMN "public"."base_thesis_title"."create_time" IS ' Creation time ';
COMMENT ON COLUMN "public"."base_thesis_title"."update_time" IS ' Modification time ';
COMMENT ON COLUMN "public"."base_thesis_title"."create_id" IS ' Create human id';
COMMENT ON COLUMN "public"."base_thesis_title"."update_id" IS ' Modify the person's id';
COMMENT ON COLUMN "public"."base_thesis_title"."subject_year_id" IS ' Course year id';
COMMENT ON TABLE "public"."base_thesis_title" IS ' Paper title table ';
-- ----------------------------
-- Records of base_thesis_title
-- ----------------------------
Create multiple-choice questions associated with the test site table :rel_examination_questions
-- ----------------------------
-- Table structure for rel_examination_questions
-- ----------------------------
DROP TABLE IF EXISTS "public"."rel_examination_questions";
CREATE TABLE "public"."rel_examination_questions" (
"id" int4 DEFAULT nextval('rel_examination_questions_seq'::regclass),
"multiple_choice_id" int4,
"examination_site_id" varchar(255) COLLATE "pg_catalog"."default",
"delete_status" int2 DEFAULT 0,
"create_time" varchar(255) COLLATE "pg_catalog"."default",
"update_time" varchar(255) COLLATE "pg_catalog"."default",
"create_id" int4,
"update_id" int4
)
;
COMMENT ON COLUMN "public"."rel_examination_questions"."id" IS ' Primary key id';
COMMENT ON COLUMN "public"."rel_examination_questions"."multiple_choice_id" IS ' Of multiple choice questions id';
COMMENT ON COLUMN "public"."rel_examination_questions"."examination_site_id" IS ' Examination site id';
COMMENT ON COLUMN "public"."rel_examination_questions"."delete_status" IS ' Delete status (0 Identity not deleted ,1 Indicates that )';
COMMENT ON COLUMN "public"."rel_examination_questions"."create_time" IS ' Creation time ';
COMMENT ON COLUMN "public"."rel_examination_questions"."update_time" IS ' Modification time ';
COMMENT ON COLUMN "public"."rel_examination_questions"."create_id" IS ' Create human id';
COMMENT ON COLUMN "public"."rel_examination_questions"."update_id" IS ' Modify the person's id';
-- ----------------------------
-- Records of rel_examination_questions
3、 ... and , Assign a sequence to a table
alter table "public"."base_case_questions" alter column "id" set default nextval('base_case_questions_seq');
alter table "public"."base_examination_site" alter column "id" set default nextval('base_examination_site_seq');
alter table "public"."base_multiple_choice" alter column "id" set default nextval('base_multiple_choice_seq');
alter table "public"."base_profession" alter column "id" set default nextval('base_profession_seq');
alter table "public"."base_rank" alter column "id" set default nextval('base_rank_seq');
alter table "public"."base_subject_year" alter column "id" set default nextval('base_subject_year_seq');
alter table "public"."base_thesis_title" alter column "id" set default nextval('base_thesis_title_seq');
alter table "public"."rel_examination_questions" alter column "id" set default nextval('rel_examination_questions_seq');
边栏推荐
- 中小型照明灯饰行业如何利用数字化转型突出重围?
- Cosmos Starport installation and startup
- Go interface implementation principle [advanced level]: type_ interface struct
- Amino encoding protocol
- es6删除对象的某个属性
- 2022年G3锅炉水处理操作证考试题库模拟考试平台操作
- OpenHarmony笔记-----------(一)
- Dfinity (ICP) deployment and development-2
- 4. fabric2.2 create and join channels (use the official demo)
- STM32CubeMX的下载和安装方式
猜你喜欢

Install cuda+cusp environment and create the first helloword starter project

Cosmos star application case

Local shooting range 2- file upload vulnerability (III) - Network Security

AcWing 1977. 信息中继(基环树,并查集)

Dfinity (ICP) basic development tutorial-5

IIS中的网站访问excel

Give code vitality -- the way to read code neatly

免费文件服务器储存技术

How to hide tabs in nailing applet

ERP基础数据 金蝶
随机推荐
Leetcode- sort arrays by parity
22 | adventure and prediction (I): hazard is both "danger" and "opportunity"
2022 electrician (elementary) examination questions and simulation examination
Dfinity (ICP) development problems and solutions-6
【PYTORCH】Expected object of type torch. xxxTensor but found type torch. cuda. xxxTensor(torch0.4.0)
CCNP_ BT static routing
Examination question bank and simulation examination for special operation certificate of safety management personnel of hazardous chemical business units in 2022
How to install the bdtab (BD) new tab plug-in in edge browser (Graphic tutorial)
Clickhouse column basic data type description
ERP basic data Kingdee
ERP基础数据 金蝶
Overall process analysis of account book operation in fabric0.6
v-for生成的子组件列表删除第n行出现数据错乱问题
直播回顾 | 积极防御体系下BAS技术创新探索
名次的确定
MySQL summary
3. deploy the fabric2.2 cluster (use the official demo)
Win10系统如何修改桌面路径
分布式系统之道:Lamport 逻辑时钟
2022起重机械指挥考试题模拟考试题库及在线模拟考试