CREATE TABLE banner (id BIGINT AUTO_INCREMENT, type_id BIGINT NOT NULL, profile_id BIGINT, filename VARCHAR(255), note VARCHAR(255), limit_from DATE, limit_to DATE, limit_clicks BIGINT, limit_views BIGINT, clicks_count BIGINT DEFAULT 0, views_count BIGINT DEFAULT 0, is_active TINYINT(1) DEFAULT '1' NOT NULL, last_show datetime, show_token TINYINT(1) DEFAULT '0' NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX type_id_idx (type_id), INDEX profile_id_idx (profile_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE banner_click (id BIGINT AUTO_INCREMENT, banner_id BIGINT NOT NULL, ip VARCHAR(255), url VARCHAR(255), user_agent VARCHAR(255), created_at DATETIME NOT NULL, INDEX banner_id_idx (banner_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE banner_region_relation (banner_id BIGINT, region_id BIGINT, PRIMARY KEY(banner_id, region_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE banner_type (id BIGINT AUTO_INCREMENT, name VARCHAR(255), width BIGINT, height BIGINT, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE banner_view (id BIGINT AUTO_INCREMENT, banner_id BIGINT NOT NULL, ip VARCHAR(255), url VARCHAR(255), user_agent VARCHAR(255), created_at DATETIME NOT NULL, INDEX banner_id_idx (banner_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE bulletin (id BIGINT AUTO_INCREMENT, subject VARCHAR(255) NOT NULL, content LONGTEXT, note LONGTEXT, subscribers_num BIGINT, is_planned TINYINT(1) DEFAULT '0' NOT NULL, planned_date DATE, send_date DATETIME, filename VARCHAR(255), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE country (id BIGINT AUTO_INCREMENT, name VARCHAR(255), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE event (id BIGINT AUTO_INCREMENT, profile_id BIGINT, name VARCHAR(255) NOT NULL, perex LONGTEXT, text LONGTEXT, contact VARCHAR(255), logo VARCHAR(255), date_from DATETIME NOT NULL, date_to DATETIME NOT NULL, region_id BIGINT NOT NULL, city VARCHAR(255), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX profile_id_idx (profile_id), INDEX region_id_idx (region_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE event_category_relation (event_id BIGINT, category_id BIGINT, PRIMARY KEY(event_id, category_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE invoice (id BIGINT AUTO_INCREMENT, number BIGINT UNIQUE NOT NULL, profile_id BIGINT, supplier_name VARCHAR(255), supplier_ic VARCHAR(255), supplier_dic VARCHAR(255), supplier_street VARCHAR(255), supplier_city VARCHAR(255), supplier_zip VARCHAR(255), subscriber_name VARCHAR(255), subscriber_ic VARCHAR(255), subscriber_dic VARCHAR(255), subscriber_street VARCHAR(255), subscriber_city VARCHAR(255), subscriber_zip VARCHAR(255), maturity_date DATE NOT NULL, payment_form VARCHAR(255), bank VARCHAR(255), account VARCHAR(255), is_paid TINYINT(1) DEFAULT '0' NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX profile_id_idx (profile_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE invoice_item (id BIGINT AUTO_INCREMENT, invoice_id BIGINT NOT NULL, job_id BIGINT, topjob_id BIGINT, banner_id BIGINT, profile_id BIGINT, text LONGTEXT, amount BIGINT DEFAULT 1 NOT NULL, price_one FLOAT(18, 2) DEFAULT 0 NOT NULL, currency CHAR(3), dph BIGINT DEFAULT 20 NOT NULL, INDEX invoice_id_idx (invoice_id), INDEX job_id_idx (job_id), INDEX topjob_id_idx (topjob_id), INDEX banner_id_idx (banner_id), INDEX profile_id_idx (profile_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE job (id BIGINT AUTO_INCREMENT, profile_id BIGINT, category_id BIGINT NOT NULL, type_id BIGINT NOT NULL, style_id BIGINT NOT NULL, country_id BIGINT NOT NULL, name VARCHAR(255) NOT NULL, city VARCHAR(255), street VARCHAR(255), zip BIGINT, text LONGTEXT, valid_from DATE NOT NULL, valid_months BIGINT DEFAULT 1 NOT NULL, valid_to DATE NOT NULL, is_active TINYINT(1) DEFAULT '0' NOT NULL, price FLOAT(18, 2) DEFAULT 0 NOT NULL, discount FLOAT(18, 2) DEFAULT 1 NOT NULL, prepayment_rows BIGINT DEFAULT 0 NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, slug VARCHAR(255), UNIQUE INDEX job_sluggable_idx (slug), INDEX profile_id_idx (profile_id), INDEX category_id_idx (category_id), INDEX type_id_idx (type_id), INDEX style_id_idx (style_id), INDEX country_id_idx (country_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE job_category (id BIGINT AUTO_INCREMENT, parent_id BIGINT, name VARCHAR(255) NOT NULL, priority BIGINT DEFAULT 100 NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, slug VARCHAR(255), UNIQUE INDEX job_category_sluggable_idx (slug), INDEX parent_id_idx (parent_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE job_region_relation (job_id BIGINT, region_id BIGINT, PRIMARY KEY(job_id, region_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE job_specialization (id BIGINT AUTO_INCREMENT, category_id BIGINT NOT NULL, name VARCHAR(255) NOT NULL, priority BIGINT DEFAULT 100 NOT NULL, INDEX category_id_idx (category_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE job_specialization_relation (job_id BIGINT, specialization_id BIGINT, PRIMARY KEY(job_id, specialization_id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE job_style (id BIGINT AUTO_INCREMENT, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE job_style_price (id BIGINT AUTO_INCREMENT, country_id BIGINT NOT NULL, style_id BIGINT NOT NULL, currency CHAR(3), row_price FLOAT(18, 2) DEFAULT 0 NOT NULL, INDEX country_id_idx (country_id), INDEX style_id_idx (style_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE job_type (id BIGINT AUTO_INCREMENT, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE page (id BIGINT AUTO_INCREMENT, title VARCHAR(255) NOT NULL, text LONGTEXT, is_deletable TINYINT(1) DEFAULT '1', created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, slug VARCHAR(255), UNIQUE INDEX page_sluggable_idx (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE prepayment_count (id BIGINT AUTO_INCREMENT, profile_id BIGINT NOT NULL, style_id BIGINT NOT NULL, count BIGINT DEFAULT 0 NOT NULL, discount FLOAT(18, 2) DEFAULT 1 NOT NULL, request_count BIGINT DEFAULT 0 NOT NULL, request_discount FLOAT(18, 2) DEFAULT 1 NOT NULL, rows BIGINT DEFAULT 0 NOT NULL, rows_discount FLOAT(18, 2) DEFAULT 1 NOT NULL, request_rows BIGINT DEFAULT 0 NOT NULL, INDEX profile_id_idx (profile_id), INDEX style_id_idx (style_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE prepayment_count_price (id BIGINT AUTO_INCREMENT, count_min BIGINT NOT NULL, price_one BIGINT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE prepayment_type (id BIGINT AUTO_INCREMENT, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE profile (id BIGINT AUTO_INCREMENT, user_id BIGINT NOT NULL, type_id BIGINT NOT NULL, name VARCHAR(255), first_name VARCHAR(255), last_name VARCHAR(255), prefix VARCHAR(255), sufix VARCHAR(255), tel VARCHAR(255), mail VARCHAR(255) NOT NULL UNIQUE, web VARCHAR(255), country_id BIGINT NOT NULL, region_id BIGINT, city VARCHAR(255), street VARCHAR(255), zip BIGINT, ic VARCHAR(255), bank_account VARCHAR(255), text LONGTEXT, is_public TINYINT(1) DEFAULT '1' NOT NULL, prepayment_type_id BIGINT DEFAULT 1 NOT NULL, prepayment_from DATE, prepayment_to DATE, prepayment_active TINYINT(1) DEFAULT '0', filename VARCHAR(255), representant_id BIGINT, is_pdf_subscriber TINYINT(1) DEFAULT '0' NOT NULL, is_eventer TINYINT(1) DEFAULT '0' NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, slug VARCHAR(255), UNIQUE INDEX profile_sluggable_idx (slug), INDEX user_id_idx (user_id), INDEX type_id_idx (type_id), INDEX prepayment_type_id_idx (prepayment_type_id), INDEX region_id_idx (region_id), INDEX country_id_idx (country_id), INDEX representant_id_idx (representant_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE profile_type (id BIGINT AUTO_INCREMENT, name VARCHAR(255) NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE region (id BIGINT AUTO_INCREMENT, name VARCHAR(255), priority BIGINT DEFAULT 100 NOT NULL, coords LONGTEXT, slug VARCHAR(255), UNIQUE INDEX region_sluggable_idx (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE representant (id BIGINT AUTO_INCREMENT, first_name VARCHAR(255), last_name VARCHAR(255), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE subscriber (id BIGINT AUTO_INCREMENT, profile_id BIGINT, name VARCHAR(255), email VARCHAR(255) NOT NULL UNIQUE, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX profile_id_idx (profile_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE top_job (id BIGINT AUTO_INCREMENT, job_id BIGINT, is_active TINYINT(1) DEFAULT '0', valid_from DATE, valid_to DATE, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX job_id_idx (job_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE top_job_price (id BIGINT AUTO_INCREMENT, days_min BIGINT NOT NULL, price_day BIGINT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE sa_setting (id BIGINT AUTO_INCREMENT, name VARCHAR(255) NOT NULL UNIQUE, type VARCHAR(255) DEFAULT 'input' NOT NULL, widget_options LONGTEXT, value LONGTEXT, setting_group VARCHAR(255), slug VARCHAR(255), UNIQUE INDEX sa_setting_sluggable_idx (slug), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE sf_guard_forgot_password (id BIGINT AUTO_INCREMENT, user_id BIGINT NOT NULL, unique_key VARCHAR(255), expires_at DATETIME NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX user_id_idx (user_id), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE sf_guard_group (id BIGINT AUTO_INCREMENT, name VARCHAR(255) UNIQUE, description TEXT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE sf_guard_group_permission (group_id BIGINT, permission_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(group_id, permission_id)) ENGINE = INNODB;
CREATE TABLE sf_guard_permission (id BIGINT AUTO_INCREMENT, name VARCHAR(255) UNIQUE, description TEXT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE sf_guard_remember_key (id BIGINT AUTO_INCREMENT, user_id BIGINT, remember_key VARCHAR(32), ip_address VARCHAR(50), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX user_id_idx (user_id), PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE sf_guard_user (id BIGINT AUTO_INCREMENT, first_name VARCHAR(255), last_name VARCHAR(255), email_address VARCHAR(255) NOT NULL UNIQUE, username VARCHAR(128) NOT NULL UNIQUE, algorithm VARCHAR(128) DEFAULT 'sha1' NOT NULL, salt VARCHAR(128), password VARCHAR(128), is_active TINYINT(1) DEFAULT '1', is_super_admin TINYINT(1) DEFAULT '0', last_login DATETIME, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX is_active_idx_idx (is_active), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_czech_ci ENGINE = INNODB;
CREATE TABLE sf_guard_user_group (user_id BIGINT, group_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(user_id, group_id)) ENGINE = INNODB;
CREATE TABLE sf_guard_user_permission (user_id BIGINT, permission_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(user_id, permission_id)) ENGINE = INNODB;
ALTER TABLE banner ADD CONSTRAINT banner_type_id_banner_type_id FOREIGN KEY (type_id) REFERENCES banner_type(id) ON DELETE CASCADE;
ALTER TABLE banner ADD CONSTRAINT banner_profile_id_profile_id FOREIGN KEY (profile_id) REFERENCES profile(id) ON DELETE CASCADE;
ALTER TABLE banner_click ADD CONSTRAINT banner_click_banner_id_banner_id FOREIGN KEY (banner_id) REFERENCES banner(id) ON DELETE CASCADE;
ALTER TABLE banner_region_relation ADD CONSTRAINT banner_region_relation_region_id_region_id FOREIGN KEY (region_id) REFERENCES region(id) ON DELETE CASCADE;
ALTER TABLE banner_region_relation ADD CONSTRAINT banner_region_relation_banner_id_banner_id FOREIGN KEY (banner_id) REFERENCES banner(id) ON DELETE CASCADE;
ALTER TABLE banner_view ADD CONSTRAINT banner_view_banner_id_banner_id FOREIGN KEY (banner_id) REFERENCES banner(id) ON DELETE CASCADE;
ALTER TABLE event ADD CONSTRAINT event_region_id_region_id FOREIGN KEY (region_id) REFERENCES region(id) ON DELETE CASCADE;
ALTER TABLE event ADD CONSTRAINT event_profile_id_profile_id FOREIGN KEY (profile_id) REFERENCES profile(id) ON DELETE CASCADE;
ALTER TABLE event_category_relation ADD CONSTRAINT event_category_relation_event_id_event_id FOREIGN KEY (event_id) REFERENCES event(id) ON DELETE CASCADE;
ALTER TABLE event_category_relation ADD CONSTRAINT event_category_relation_category_id_job_category_id FOREIGN KEY (category_id) REFERENCES job_category(id) ON DELETE CASCADE;
ALTER TABLE invoice ADD CONSTRAINT invoice_profile_id_profile_id FOREIGN KEY (profile_id) REFERENCES profile(id) ON DELETE SET NULL;
ALTER TABLE invoice_item ADD CONSTRAINT invoice_item_topjob_id_top_job_id FOREIGN KEY (topjob_id) REFERENCES top_job(id) ON DELETE SET NULL;
ALTER TABLE invoice_item ADD CONSTRAINT invoice_item_profile_id_profile_id FOREIGN KEY (profile_id) REFERENCES profile(id) ON DELETE SET NULL;
ALTER TABLE invoice_item ADD CONSTRAINT invoice_item_job_id_job_id FOREIGN KEY (job_id) REFERENCES job(id) ON DELETE SET NULL;
ALTER TABLE invoice_item ADD CONSTRAINT invoice_item_invoice_id_invoice_id FOREIGN KEY (invoice_id) REFERENCES invoice(id) ON DELETE CASCADE;
ALTER TABLE invoice_item ADD CONSTRAINT invoice_item_banner_id_banner_id FOREIGN KEY (banner_id) REFERENCES banner(id) ON DELETE SET NULL;
ALTER TABLE job ADD CONSTRAINT job_type_id_job_type_id FOREIGN KEY (type_id) REFERENCES job_type(id) ON DELETE CASCADE;
ALTER TABLE job ADD CONSTRAINT job_style_id_job_style_id FOREIGN KEY (style_id) REFERENCES job_style(id) ON DELETE CASCADE;
ALTER TABLE job ADD CONSTRAINT job_profile_id_profile_id FOREIGN KEY (profile_id) REFERENCES profile(id) ON DELETE CASCADE;
ALTER TABLE job ADD CONSTRAINT job_country_id_country_id FOREIGN KEY (country_id) REFERENCES country(id) ON DELETE CASCADE;
ALTER TABLE job ADD CONSTRAINT job_category_id_job_category_id FOREIGN KEY (category_id) REFERENCES job_category(id) ON DELETE CASCADE;
ALTER TABLE job_category ADD CONSTRAINT job_category_parent_id_job_category_id FOREIGN KEY (parent_id) REFERENCES job_category(id) ON DELETE CASCADE;
ALTER TABLE job_region_relation ADD CONSTRAINT job_region_relation_region_id_region_id FOREIGN KEY (region_id) REFERENCES region(id) ON DELETE CASCADE;
ALTER TABLE job_region_relation ADD CONSTRAINT job_region_relation_job_id_job_id FOREIGN KEY (job_id) REFERENCES job(id) ON DELETE CASCADE;
ALTER TABLE job_specialization ADD CONSTRAINT job_specialization_category_id_job_category_id FOREIGN KEY (category_id) REFERENCES job_category(id) ON DELETE CASCADE;
ALTER TABLE job_specialization_relation ADD CONSTRAINT jsji FOREIGN KEY (specialization_id) REFERENCES job_specialization(id) ON DELETE CASCADE;
ALTER TABLE job_specialization_relation ADD CONSTRAINT job_specialization_relation_job_id_job_id FOREIGN KEY (job_id) REFERENCES job(id) ON DELETE CASCADE;
ALTER TABLE job_style_price ADD CONSTRAINT job_style_price_style_id_job_style_id FOREIGN KEY (style_id) REFERENCES job_style(id) ON DELETE CASCADE;
ALTER TABLE job_style_price ADD CONSTRAINT job_style_price_country_id_country_id FOREIGN KEY (country_id) REFERENCES country(id) ON DELETE CASCADE;
ALTER TABLE prepayment_count ADD CONSTRAINT prepayment_count_style_id_job_style_id FOREIGN KEY (style_id) REFERENCES job_style(id) ON DELETE CASCADE;
ALTER TABLE prepayment_count ADD CONSTRAINT prepayment_count_profile_id_profile_id FOREIGN KEY (profile_id) REFERENCES profile(id) ON DELETE CASCADE;
ALTER TABLE profile ADD CONSTRAINT profile_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE;
ALTER TABLE profile ADD CONSTRAINT profile_type_id_profile_type_id FOREIGN KEY (type_id) REFERENCES profile_type(id) ON DELETE CASCADE;
ALTER TABLE profile ADD CONSTRAINT profile_representant_id_representant_id FOREIGN KEY (representant_id) REFERENCES representant(id) ON DELETE SET NULL;
ALTER TABLE profile ADD CONSTRAINT profile_region_id_region_id FOREIGN KEY (region_id) REFERENCES region(id) ON DELETE CASCADE;
ALTER TABLE profile ADD CONSTRAINT profile_prepayment_type_id_prepayment_type_id FOREIGN KEY (prepayment_type_id) REFERENCES prepayment_type(id) ON DELETE CASCADE;
ALTER TABLE profile ADD CONSTRAINT profile_country_id_country_id FOREIGN KEY (country_id) REFERENCES country(id) ON DELETE CASCADE;
ALTER TABLE subscriber ADD CONSTRAINT subscriber_profile_id_profile_id FOREIGN KEY (profile_id) REFERENCES profile(id) ON DELETE CASCADE;
ALTER TABLE top_job ADD CONSTRAINT top_job_job_id_job_id FOREIGN KEY (job_id) REFERENCES job(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_forgot_password ADD CONSTRAINT sf_guard_forgot_password_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_group_permission ADD CONSTRAINT sf_guard_group_permission_permission_id_sf_guard_permission_id FOREIGN KEY (permission_id) REFERENCES sf_guard_permission(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_group_permission ADD CONSTRAINT sf_guard_group_permission_group_id_sf_guard_group_id FOREIGN KEY (group_id) REFERENCES sf_guard_group(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_remember_key ADD CONSTRAINT sf_guard_remember_key_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_user_group ADD CONSTRAINT sf_guard_user_group_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_user_group ADD CONSTRAINT sf_guard_user_group_group_id_sf_guard_group_id FOREIGN KEY (group_id) REFERENCES sf_guard_group(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_user_permission ADD CONSTRAINT sf_guard_user_permission_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE;
ALTER TABLE sf_guard_user_permission ADD CONSTRAINT sf_guard_user_permission_permission_id_sf_guard_permission_id FOREIGN KEY (permission_id) REFERENCES sf_guard_permission(id) ON DELETE CASCADE;
