CREATE TABLE studio_locations (id BIGINT AUTO_INCREMENT, title VARCHAR(100), description TEXT, address TEXT, metas TEXT, date_time DATE DEFAULT '0000-00-00', PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE makeover_products (id BIGINT AUTO_INCREMENT, category_id BIGINT, title VARCHAR(100), price VARCHAR(100), max_people_per_group VARCHAR(100), refreshment TINYINT(1) DEFAULT 0, hair_cleaner_condition TINYINT(1) DEFAULT 0, hair_consultation TINYINT(1) DEFAULT 0, cut TINYINT(1) DEFAULT 0, blowdry TINYINT(1) DEFAULT 0, finish TINYINT(1) DEFAULT 0, new_id_consultation TINYINT(1) DEFAULT 0, hand_beauty_treatments TINYINT(1) DEFAULT 0, skin_refresh TINYINT(1) DEFAULT 0, mak_up_applied TINYINT(1) DEFAULT 0, hair_styled TINYINT(1) DEFAULT 0, prof_photoshoot TINYINT(1) DEFAULT 0, prof_viewing TINYINT(1) DEFAULT 0, prof_prints VARCHAR(100), short_description VARCHAR(100), long_description TEXT, additional_price VARCHAR(100), metas TEXT, image_id BIGINT, is_confirmed BIGINT DEFAULT '1', date_time DATE DEFAULT '0000-00-00', INDEX image_id_idx (image_id), INDEX category_id_idx (category_id), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE Makeover_products_photostrp (id BIGINT AUTO_INCREMENT, makeover_product_id BIGINT, image_id BIGINT, date_time DATE DEFAULT '0000-00-00', INDEX makeover_product_id_idx (makeover_product_id), INDEX image_id_idx (image_id), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE studio_pics (id BIGINT AUTO_INCREMENT, location_id BIGINT, image_id BIGINT, INDEX location_id_idx (location_id), INDEX image_id_idx (image_id), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE magzine (id BIGINT AUTO_INCREMENT, title VARCHAR(100), description TEXT, is_active TINYINT(1) DEFAULT 0, date_time DATE DEFAULT '0000-00-00', PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE products (id BIGINT AUTO_INCREMENT, category_id BIGINT, title VARCHAR(100), description TEXT, shade_ref VARCHAR(100), code_ref VARCHAR(100), metas TEXT, price VARCHAR(100), image_id BIGINT, date_time DATE DEFAULT '0000-00-00', INDEX image_id_idx (image_id), INDEX category_id_idx (category_id), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE images (id BIGINT AUTO_INCREMENT, path VARCHAR(255), type MEDIUMINT, PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE products_shades (id BIGINT AUTO_INCREMENT, title VARCHAR(100), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE videos (id BIGINT AUTO_INCREMENT, path VARCHAR(255), type MEDIUMINT, PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE Country (country_id BIGINT AUTO_INCREMENT, country_name VARCHAR(255), country_iso_code_2 VARCHAR(255), country_iso_code_3 VARCHAR(255), PRIMARY KEY(country_id)) ENGINE = INNODB;
CREATE TABLE makeover_categories (id BIGINT AUTO_INCREMENT, title VARCHAR(255), metas VARCHAR(255), description VARCHAR(255), video_id BIGINT, image_id BIGINT, is_video BIGINT DEFAULT '0', INDEX image_id_idx (image_id), INDEX video_id_idx (video_id), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE vacancies (id BIGINT AUTO_INCREMENT, title VARCHAR(100), description TEXT, location_id VARCHAR(100), is_active TINYINT(1) DEFAULT 0, date_time DATE DEFAULT '0000-00-00', opening_date DATE DEFAULT '0000-00-00', closing_date DATE DEFAULT '0000-00-00', INDEX location_id_idx (location_id), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE product_categories (id BIGINT AUTO_INCREMENT, title VARCHAR(100), description TEXT, metas TEXT, image_id BIGINT, parent_id BIGINT DEFAULT '0', date_time DATE DEFAULT '0000-00-00', INDEX image_id_idx (image_id), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE staff (id BIGINT UNSIGNED AUTO_INCREMENT, name VARCHAR(255), password VARCHAR(255), username VARCHAR(255), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE Public_Pages (id BIGINT AUTO_INCREMENT, title VARCHAR(255), page_content TEXT, last_update DATE, PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE magzine_photos (id BIGINT AUTO_INCREMENT, magzine_id BIGINT, defaults BIGINT, image_id BIGINT, caption VARCHAR(255), INDEX magzine_id_idx (magzine_id), INDEX image_id_idx (image_id), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE news_letter (id BIGINT AUTO_INCREMENT, title VARCHAR(100), description TEXT, date_time DATE DEFAULT '0000-00-00', PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE gallery (id BIGINT AUTO_INCREMENT, title VARCHAR(100), description TEXT, is_active TINYINT(1) DEFAULT 0, date_time DATE DEFAULT '0000-00-00', PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE gallery_photos (id BIGINT AUTO_INCREMENT, gallery_id BIGINT, title VARCHAR(100), original_image_id BIGINT, cropped_image_id BIGINT, date_time DATE DEFAULT '0000-00-00', INDEX original_image_id_idx (original_image_id), INDEX gallery_id_idx (gallery_id), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE tickets (id BIGINT AUTO_INCREMENT, name VARCHAR(255), telephone VARCHAR(100), email VARCHAR(100), hear_about_us VARCHAR(100), comment TEXT, status SMALLINT DEFAULT '0', date_time DATETIME DEFAULT '0000-00-00 00:00:00', PRIMARY KEY(id)) ENGINE = INNODB;
ALTER TABLE makeover_products ADD FOREIGN KEY (image_id) REFERENCES images(id);
ALTER TABLE makeover_products ADD FOREIGN KEY (category_id) REFERENCES makeover_categories(id);
ALTER TABLE Makeover_products_photostrp ADD FOREIGN KEY (makeover_product_id) REFERENCES makeover_products(id);
ALTER TABLE Makeover_products_photostrp ADD FOREIGN KEY (image_id) REFERENCES images(id);
ALTER TABLE studio_pics ADD FOREIGN KEY (location_id) REFERENCES studio_locations(id);
ALTER TABLE studio_pics ADD FOREIGN KEY (image_id) REFERENCES images(id);
ALTER TABLE products ADD FOREIGN KEY (image_id) REFERENCES images(id);
ALTER TABLE products ADD FOREIGN KEY (category_id) REFERENCES product_categories(id);
ALTER TABLE makeover_categories ADD FOREIGN KEY (video_id) REFERENCES videos(id);
ALTER TABLE makeover_categories ADD FOREIGN KEY (image_id) REFERENCES images(id);
ALTER TABLE vacancies ADD FOREIGN KEY (location_id) REFERENCES studio_locations(id);
ALTER TABLE product_categories ADD FOREIGN KEY (image_id) REFERENCES images(id);
ALTER TABLE magzine_photos ADD FOREIGN KEY (magzine_id) REFERENCES magzine(id);
ALTER TABLE magzine_photos ADD FOREIGN KEY (image_id) REFERENCES images(id);
ALTER TABLE gallery_photos ADD FOREIGN KEY (original_image_id) REFERENCES images(id);
ALTER TABLE gallery_photos ADD FOREIGN KEY (gallery_id) REFERENCES gallery(id);
