-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b3fdac
commit 053aedd
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
BEGIN; | ||
DROP TABLE IF EXISTS admins,estates,agents,images; | ||
CREATE TABLE admins( | ||
id SERIAL PRIMARY KEY, | ||
username VARCHAR(255) NOT NULL, | ||
password VARCHAR(255) NOT NULL, | ||
email VARCHAR(255) NOT NULL UNIQUE | ||
); | ||
CREATE TABLE agents( | ||
id SERIAL PRIMARY KEY, | ||
name VARCHAR(255) NOT NULL, | ||
email VARCHAR(255) UNIQUE, | ||
phone VARCHAR(255) NOT NULL UNIQUE, | ||
image TEXT, | ||
location VARCHAR(255) NOT NULL, | ||
password VARCHAR(255) NOT NULL | ||
); | ||
CREATE TABLE estates( | ||
id SERIAL PRIMARY KEY, | ||
agent_id INTEGER REFERENCES agents(id) ON DELETE CASCADE, | ||
title VARCHAR(255) NOT NULL, | ||
price DECIMAL NOT NULL, | ||
description TEXT NOT NULL, | ||
type VARCHAR(255) NOT NULL, | ||
category VARCHAR(255) NOT NULL, | ||
street VARCHAR(255) NOT NULL, | ||
city VARCHAR(255) NOT NULL, | ||
region VARCHAR(255) NOT NULL, | ||
bathrooms INTEGER DEFAULT 0, | ||
bedrooms INTEGER DEFAULT 0, | ||
rooms INTEGER DEFAULT 0, | ||
space DECIMAL NOT NULL , | ||
approved BOOLEAN DEFAULT FALSE, | ||
rate INTEGER DEFAULT 0, | ||
available BOOLEAN DEFAULT TRUE | ||
); | ||
|
||
CREATE TABLE images( | ||
id SERIAL PRIMARY KEY, | ||
estate_id INTEGER REFERENCES estates(id) ON DELETE CASCADE, | ||
image TEXT | ||
); | ||
COMMIT; |