-
Notifications
You must be signed in to change notification settings - Fork 0
/
create.txt
67 lines (61 loc) · 1.92 KB
/
create.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
CREATE TABLE OLD_SYS_USER (
USERID serial NOT NULL,
NAME varchar(20) NOT NULL,
LASTNAME varchar(20) NOT NULL,
EMAIL varchar(40) NOT NULL,
PHONE varchar(15) NOT NULL,
NICK varchar(20) NOT NULL,
PASSWORD varchar(20) NOT NULL,
CONSTRAINT USER_PKEY PRIMARY KEY (USERID),
CONSTRAINT "UNIQUE(NAME)" UNIQUE(NICK)
);
CREATE TABLE OLD_PUBLICATION (
PUBLICATIONID serial NOT NULL,
userId int NOT NULL,
type int NOT NULL,
operation_type int NOT NULL,
address varchar(50) NOT NULL,
city varchar(30) NOT NULL,
price float NOT NULL,
environments int NOT NULL,
covered float NOT NULL,
uncovered float NOT NULL,
age int NOT NULL,
cable boolean NOT NULL,
phone boolean NOT NULL,
pool boolean NOT NULL,
living boolean NOT NULL,
paddle boolean NOT NULL,
barbecue boolean NOT NULL,
description varchar(1000),
active boolean NOT NULL,
CONSTRAINT "PUBLICATION_PRIMARY_KEY" PRIMARY KEY(PUBLICATIONID),
CONSTRAINT "PUBLICATION_FK_USER" FOREIGN KEY(userId)
REFERENCES OLD_SYS_USER (USERID) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
);
CREATE TABLE OLD_PHOTO (
PHOTOID serial NOT NULL,
PUBLICATIONID int NOT NULL,
PHOTO bytea NOT NULL,
CONSTRAINT "PHOTO_PRIMARY_KEY" PRIMARY KEY(PHOTOID),
CONSTRAINT "PHOTO_FK_PUBLI" FOREIGN KEY(PUBLICATIONID)
REFERENCES OLD_PUBLICATION (PUBLICATIONID) MATCH SIMPLE
ON UPDATE NO ACTION ON DELETE NO ACTION
);
CREATE TABLE OLD_property_type
(
id integer NOT NULL,
description character varying(10),
CONSTRAINT property_type_pkey PRIMARY KEY (id)
);
CREATE TABLE OLD_operation_type
(
id integer NOT NULL,
description character varying(10),
CONSTRAINT operation_type_pkey PRIMARY KEY (id)
);
INSERT INTO OLD_PROPERTY_TYPE(id, description) VALUES('1', 'Casa');
INSERT INTO OLD_PROPERTY_TYPE(id, description) VALUES('2', 'Depto.');
INSERT INTO OLD_OPERATION_TYPE(id, description) VALUES('1', 'Venta');
INSERT INTO OLD_OPERATION_TYPE(id, description) VALUES('2', 'Alquiler');