Datenbanktabellen anlegen
Legen Sie in Postgres die folgenden Datenbanktabellen an:
(eine Datei mit der DDL gibt es auch hier)
psql -Ujboss jboss
jboss=> \i weblog_pg.ddl
CREATE TABLE wl_artikel
(
id bigint NOT NULL,
"version" bigint NOT NULL,
"text" text,
datum date,
titel character varying(255),
weblog_id bigint,
poster_email character varying(64),
CONSTRAINT wl_artikel_pkey PRIMARY KEY (id),
CONSTRAINT fkcd678ea2df28cc9f FOREIGN KEY (weblog_id)
REFERENCES wl_weblogs (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fkcd678ea2f8888c5c FOREIGN KEY (poster_email)
REFERENCES wl_nutzer (email) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS=FALSE);
ALTER TABLE wl_artikel OWNER TO jboss;
CREATE TABLE wl_nutzer
(
dtype character varying(31) NOT NULL,
email character varying(64) NOT NULL,
"version" integer NOT NULL,
passwort character varying(32),
rolle character varying(12),
dateintrag date,
optin boolean,
"name" character varying(16),
"level" integer,
CONSTRAINT wl_nutzer_pkey PRIMARY KEY (email),
CONSTRAINT wl_nutzer_name_key UNIQUE (name)
)
WITH (OIDS=FALSE);
ALTER TABLE wl_nutzer OWNER TO jboss;
CREATE TABLE wl_pextra
(
geekcode text,
email character varying(64) NOT NULL,
CONSTRAINT wl_pextra_pkey PRIMARY KEY (email),
CONSTRAINT fk68135e4af32d19ce FOREIGN KEY (email)
REFERENCES wl_nutzer (email) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS=FALSE);
ALTER TABLE wl_pextra OWNER TO jboss;
CREATE TABLE wl_weblog_nutzer
(
wl_weblogs_id bigint NOT NULL,
nutzer_email character varying(64) NOT NULL,
CONSTRAINT fk8f9fdbbf3d42bfd6 FOREIGN KEY (wl_weblogs_id)
REFERENCES wl_weblogs (id) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION,
CONSTRAINT fk8f9fdbbfd150e3f6 FOREIGN KEY (nutzer_email)
REFERENCES wl_nutzer (email) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
)
WITH (OIDS=FALSE);
ALTER TABLE wl_weblog_nutzer OWNER TO jboss;
CREATE TABLE wl_weblogs
(
id bigint NOT NULL,
"name" character varying(64),
"version" bigint NOT NULL,
CONSTRAINT wl_weblogs_pkey PRIMARY KEY (id),
CONSTRAINT wl_weblogs_name_key UNIQUE (name)
)
WITH (OIDS=FALSE);
ALTER TABLE wl_weblogs OWNER TO jboss;