数据库UML图关系

时间:2016-06-28 06:22:32

标签: database postgresql data-structures foreign-key-relationship erd

我想知道为什么有色关系类型不同...... 据我所知,从我的数据库结构中,我可以从codificators_document_typedocument表中得到零或多个值,这个编码器是强制性的。

同样应该是codificator_document_source_type,但我无法弄清楚为什么关系类型不同。 :(

enter image description here

CREATE TABLE document
(
  source_id integer NOT NULL,
  ....
  type_id character varying(2) NOT NULL,
  register_type_id character varying(1),
  source_type_id character varying(20) NOT NULL,
  CONSTRAINT document_pkey PRIMARY KEY (id),
  CONSTRAINT document_register_type_fkey FOREIGN KEY (register_type_id)
      REFERENCES codificator_document_register_type (id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT document_source_type_fkey FOREIGN KEY (source_type_id)
      REFERENCES codificator_document_source_type (id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION,
  CONSTRAINT document_type_fkey FOREIGN KEY (type_id)
      REFERENCES codificator_document_type (id) MATCH SIMPLE
      ON UPDATE NO ACTION ON DELETE NO ACTION

CREATE TABLE codificator_document_register_type
(
  id character varying(1) NOT NULL,
  value character varying(255) NOT NULL,
  CONSTRAINT codificator_document_register_pkey PRIMARY KEY (id)
)

CREATE TABLE codificator_document_source_type
(
  id character varying(10) NOT NULL,
  value character varying(255) NOT NULL,
  CONSTRAINT document_source_type_pkey PRIMARY KEY (id)
)

CREATE TABLE codificator_document_type
(
  id character varying(10) NOT NULL,
  value character varying(255) NOT NULL,
  CONSTRAINT codificator_document_type_pkey PRIMARY KEY (id)
)

0 个答案:

没有答案