我正在开发一个在表之间具有不同类型关系的数据库:1:M 和 M:N。我已经在 PG Admin 4 中通过外键定义了关系。
当我在QGIS中打开模型时,我只得到关联类型关系,但对于中间表(M:N关系,红色矩形)我需要组合强度关系。
知道如何在 PG Admin 4 中定义强度关系吗?
谢谢大家
这是其中之一的 SQL 代码示例:
DROP TABLE IF EXISTS sdt_transports.arret;
CREATE TABLE IF NOT EXISTS sdt_transports.arret
(
objectid_arret integer NOT NULL DEFAULT nextval('sdt_transports.arret_objectid_arret_seq'::regclass),
id_arret integer,
nom_arret character varying(50) COLLATE pg_catalog."default",
ref_etat_exploitation integer,
abreviation_arret character varying(10) COLLATE pg_catalog."default",
arret_regional smallint,
arret_urbain smallint,
sens_alle smallint,
sens_retour smallint,
url_horaire_passage character varying(255) COLLATE pg_catalog."default",
url_horaire_passage_exception smallint,
url_horaire_origine character varying(255) COLLATE pg_catalog."default",
url_horaire_origine_exception smallint,
url_horaire_destination character varying(255) COLLATE pg_catalog."default",
url_horaire_destination_exception smallint,
url_information character varying(255) COLLATE pg_catalog."default",
url_information_exception smallint,
niveau_equipement character varying(50) COLLATE pg_catalog."default",
rem_equipement character varying(250) COLLATE pg_catalog."default",
niveau_offre smallint,
pers_montante smallint,
pers_descente smallint,
url_statistique character varying(255) COLLATE pg_catalog."default",
url_statistique_exception smallint,
no_localite smallint,
commentaires character varying(250) COLLATE pg_catalog."default",
niveau_service character varying(50) COLLATE pg_catalog."default",
user_mise_a_jour character varying(255) COLLATE pg_catalog."default",
date_mise_a_jour timestamp without time zone,
x double precision,
y double precision,
geom geometry,
CONSTRAINT arret_pkey PRIMARY KEY (objectid_arret)
)
WITH (
OIDS = FALSE
);
DROP TABLE IF EXISTS sdt_transports.cadre_horaire;
CREATE TABLE IF NOT EXISTS sdt_transports.cadre_horaire
(
objectid_cadre_horaire integer NOT NULL DEFAULT nextval('sdt_transports.cadre_horaire_objectid_cadre_horaire_seq'::regclass),
id_cadre_horaire character varying(30) COLLATE pg_catalog."default",
nom_cadre_horaire character varying(150) COLLATE pg_catalog."default",
url_cadre_horaire character varying(255) COLLATE pg_catalog."default",
url_cadre_horaire_exception smallint,
commentaires character varying(250) COLLATE pg_catalog."default",
user_mise_a_jour character varying(255) COLLATE pg_catalog."default",
date_mise_a_jour timestamp without time zone,
CONSTRAINT cadre_horaire_pkey PRIMARY KEY (objectid_cadre_horaire)
)
WITH (
OIDS = FALSE
DROP TABLE IF EXISTS sdt_transports.link_arret_cadre_horaire;
CREATE TABLE IF NOT EXISTS sdt_transports.link_arret_cadre_horaire
(
objectid_link_arret_cadre_horaire integer NOT NULL DEFAULT nextval('sdt_transports.link_arret_cadre_horaire_objectid_link_arret_cadre_horaire_seq'::regclass),
objectid_arret integer,
objectid_cadre_horaire integer,
user_mise_a_jour character varying(255) COLLATE pg_catalog."default",
date_mise_a_jour timestamp without time zone,
CONSTRAINT link_arret_cadre_horaire_pkey PRIMARY KEY (objectid_link_arret_cadre_horaire)
)
WITH (
OIDS = FALSE
);
ALTER TABLE IF EXISTS sdt_transports.link_arret_cadre_horaire
ADD FOREIGN KEY (objectid_arret)
REFERENCES sdt_transports.arret (objectid_arret) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID;
ALTER TABLE IF EXISTS sdt_transports.link_arret_cadre_horaire
ADD FOREIGN KEY (objectid_cadre_horaire)
REFERENCES sdt_transports.cadre_horaire (objectid_cadre_horaire) MATCH SIMPLE
ON UPDATE NO ACTION
ON DELETE NO ACTION
NOT VALID;