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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
| --
-- Database: 'rgimmob'
--
-- --------------------------------------------------------
--
-- Table structure for table admin
--
CREATE TABLE IF NOT EXISTS users(
id_user INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
first_name varchar(128) NOT NULL,
last_name varchar(128) NOT NULL,
sex varchar(1) NOT NULL,
birthdate date NOT NULL DEFAULT '1960-08-01',
email varchar(128) NOT NULL DEFAULT 'agent@immobilier.org',
phone_number varchar(128),
login varchar(128) NOT NULL,
password varchar(128) NOT NULL DEFAULT 'immobilier',
account_type varchar(128),
connect_number INT UNSIGNED NOT NULL DEFAULT 0,
account_state ENUM('actived', 'disactived') DEFAULT 'actived'
)ENGINE="InnoDB";
--
-- Dumping data for table admin
--
INSERT INTO users VALUES(1, 'Fortune', 'JOHN', 'M', '1988-05-13', 'fjohn@gmail.com', '97793600', 'bamboo', '5f4dcc3b5aa765d61d8327deb882cf99', 'super-admin', 0, 'actived');
-- --------------------------------------------------------
--
-- Table structure for table customer
--
CREATE TABLE IF NOT EXISTS customer(
id_customer INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
first_name varchar(128) NOT NULL,
last_name varchar(128) NOT NULL,
sex varchar(1) NOT NULL,
birthdate date NOT NULL DEFAULT '1960-08-01',
email varchar(128) NOT NULL DEFAULT 'customer@immobilier.org',
phone_number varchar(128),
profession VARCHAR(128),
customer_type ENUM('apartment_holder', 'house_owner'),
customer_password VARCHAR(128) NOT NULL DEFAULT 'c82b5ce5ee635ffcc0521e9705d3d4a0',
connect_number INT UNSIGNED NOT NULL DEFAULT 0
)ENGINE="InnoDB";
--
-- Dumping data for table `tblclasses`
--
-- --------------------------------------------------------
--
-- Table structure for table home
--
CREATE TABLE IF NOT EXISTS house(
id_house INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
house_name VARCHAR(256),
house_description VARCHAR(256),
house_localisation VARCHAR(256),
house_owner INT UNSIGNED NOT NULL,
FOREIGN KEY (house_owner) REFERENCES customer (id_customer)
)ENGINE="InnoDB";
--
-- Dumping data for table home
--
-- --------------------------------------------------------
--
-- Table structure for table apartment
--
CREATE TABLE IF NOT EXISTS apartment(
id_apartment INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
apartment_type VARCHAR(128),
apartment_state ENUM('empty', 'occuped') DEFAULT 'empty',
apartment_price INT UNSIGNED NOT NULL DEFAULT 0,
apartment_house INT UNSIGNED NOT NULL,
FOREIGN KEY (apartment_house) REFERENCES house(id_house)
)ENGINE="InnoDB";
-- --------------------------------------------------------
--
-- Table structure for table contrat
--
CREATE TABLE IF NOT EXISTS contrat(
id_contrat INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
apartment INT UNSIGNED NOT NULL,
apartment_holder INT UNSIGNED NOT NULL,
agent INT UNSIGNED NOT NULL,
apartment_caution FLOAT UNSIGNED DEFAULT 0,
water_electricity_caution FLOAT UNSIGNED DEFAULT 0,
payment_date INTEGER NOT NULL DEFAULT 10,
signature_date DATE,
FOREIGN KEY (apartment) REFERENCES apartment(id_apartment),
FOREIGN KEY (apartment_holder) REFERENCES customer(id_customer),
FOREIGN KEY (agent) REFERENCES users(id_user)
)ENGINE="InnoDB";
---------------------------------------------------------------
--
-- Table structure for table apartment_payment
--
CREATE TABLE IF NOT EXISTS apartment_payment(
apartment INT UNSIGNED NOT NULL,
apartment_holder INT UNSIGNED NOT NULL,
next_payment_date DATE,
payed BOOLEAN NOT NULL DEFAULT False,
paid_date DATE,
agent INT UNSIGNED NOT NULL,
FOREIGN KEY (apartment) REFERENCES apartment(id_apartment),
FOREIGN KEY (apartment_holder) REFERENCES customer(id_customer),
FOREIGN KEY (agent) REFERENCES users(id_user)
)ENGINE="InnoDB";
COMMIT; |
Partager