CREATE TABLE baner_translation (id BIGINT, tekst LONGTEXT NOT NULL, lang CHAR(2), PRIMARY KEY(id, lang)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE baner (id BIGINT AUTO_INCREMENT, id_usera INT NOT NULL, pierwotna_nazwa VARCHAR(250) NOT NULL, nazwa_zdjecia VARCHAR(250) NOT NULL, rozszerzenie VARCHAR(10) NOT NULL, typ_mime VARCHAR(250) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX id_usera_idx (id_usera), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE blog_translation (id BIGINT, temat VARCHAR(250) NOT NULL, tresc LONGTEXT NOT NULL, lang CHAR(2), PRIMARY KEY(id, lang)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE blog (id BIGINT AUTO_INCREMENT, id_usera INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX id_usera_idx (id_usera), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE dziennik_translation (id BIGINT, temat VARCHAR(250) NOT NULL, tresc LONGTEXT NOT NULL, lang CHAR(2), PRIMARY KEY(id, lang)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE dziennik (id BIGINT AUTO_INCREMENT, id_usera INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX id_usera_idx (id_usera), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE kategoria_translation (id BIGINT, kategoria VARCHAR(50) NOT NULL, opis LONGTEXT NOT NULL, daty_podrozy VARCHAR(50) NOT NULL, lang CHAR(2), PRIMARY KEY(id, lang)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE kategoria (id BIGINT AUTO_INCREMENT, id_usera INT NOT NULL, aktywna TINYINT(1) DEFAULT '1' NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX id_usera_idx (id_usera), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE komentarz_bloga (id BIGINT AUTO_INCREMENT, id_bloga BIGINT NOT NULL, nick VARCHAR(50) NOT NULL, tresc LONGTEXT NOT NULL, opublikowano TINYINT(1) DEFAULT '0' NOT NULL, zobaczono TINYINT(1) DEFAULT '0' NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX id_bloga_idx (id_bloga), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE komentarz_kategorii (id BIGINT AUTO_INCREMENT, id_kategorii BIGINT NOT NULL, nick VARCHAR(50) NOT NULL, tresc LONGTEXT NOT NULL, opublikowano TINYINT(1) DEFAULT '0' NOT NULL, zobaczono TINYINT(1) DEFAULT '0' NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX id_kategorii_idx (id_kategorii), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE kontakt_translation (id BIGINT, tresc LONGTEXT NOT NULL, lang CHAR(2), PRIMARY KEY(id, lang)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE kontakt (id BIGINT AUTO_INCREMENT, id_usera INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX id_usera_idx (id_usera), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE news_translation (id BIGINT, temat VARCHAR(250) NOT NULL, tresc LONGTEXT NOT NULL, lang CHAR(2), PRIMARY KEY(id, lang)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE news (id BIGINT AUTO_INCREMENT, id_usera INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX id_usera_idx (id_usera), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE o_mnie_translation (id BIGINT, tresc LONGTEXT NOT NULL, lang CHAR(2), PRIMARY KEY(id, lang)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE o_mnie (id BIGINT AUTO_INCREMENT, id_usera INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX id_usera_idx (id_usera), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE strona_glowna_translation (id BIGINT, tytul_powitania VARCHAR(100) NOT NULL, tresc_powitania LONGTEXT NOT NULL, tresc_ostatnich_podrozy LONGTEXT NOT NULL, lang CHAR(2), PRIMARY KEY(id, lang)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE strona_glowna (id BIGINT AUTO_INCREMENT, id_usera INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX id_usera_idx (id_usera), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE szkocja_translation (id BIGINT, temat VARCHAR(250) NOT NULL, tresc LONGTEXT NOT NULL, lang CHAR(2), PRIMARY KEY(id, lang)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE szkocja (id BIGINT AUTO_INCREMENT, id_usera INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX id_usera_idx (id_usera), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE tv_translation (id BIGINT, temat VARCHAR(250) NOT NULL, tresc LONGTEXT NOT NULL, lang CHAR(2), PRIMARY KEY(id, lang)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE tv (id BIGINT AUTO_INCREMENT, id_usera INT NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX id_usera_idx (id_usera), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE zdjecie (id BIGINT AUTO_INCREMENT, id_kategorii BIGINT NOT NULL, glowne TINYINT(1) DEFAULT '0' NOT NULL, pierwotna_nazwa VARCHAR(250) NOT NULL, nazwa_zdjecia VARCHAR(250) NOT NULL, nazwa_miniatury VARCHAR(250) NOT NULL, rozszerzenie VARCHAR(10) NOT NULL, typ_mime VARCHAR(250) NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX id_kategorii_idx (id_kategorii), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = INNODB;
CREATE TABLE sf_guard_group (id INT AUTO_INCREMENT, name VARCHAR(255) UNIQUE, description TEXT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE sf_guard_group_permission (group_id INT, permission_id INT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(group_id, permission_id)) ENGINE = INNODB;
CREATE TABLE sf_guard_permission (id INT AUTO_INCREMENT, name VARCHAR(255) UNIQUE, description TEXT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB;
CREATE TABLE sf_guard_remember_key (id INT AUTO_INCREMENT, user_id INT, 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, ip_address)) ENGINE = INNODB;
CREATE TABLE sf_guard_user (id INT AUTO_INCREMENT, 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, email VARCHAR(100) NOT NULL, imie VARCHAR(25), nazwisko VARCHAR(50), 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_unicode_ci ENGINE = INNODB;
CREATE TABLE sf_guard_user_group (user_id INT, group_id INT, 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 INT, permission_id INT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(user_id, permission_id)) ENGINE = INNODB;
ALTER TABLE baner_translation ADD CONSTRAINT baner_translation_id_baner_id FOREIGN KEY (id) REFERENCES baner(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE baner ADD CONSTRAINT baner_id_usera_sf_guard_user_id FOREIGN KEY (id_usera) REFERENCES sf_guard_user(id);
ALTER TABLE blog_translation ADD CONSTRAINT blog_translation_id_blog_id FOREIGN KEY (id) REFERENCES blog(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE blog ADD CONSTRAINT blog_id_usera_sf_guard_user_id FOREIGN KEY (id_usera) REFERENCES sf_guard_user(id);
ALTER TABLE dziennik_translation ADD CONSTRAINT dziennik_translation_id_dziennik_id FOREIGN KEY (id) REFERENCES dziennik(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE dziennik ADD CONSTRAINT dziennik_id_usera_sf_guard_user_id FOREIGN KEY (id_usera) REFERENCES sf_guard_user(id);
ALTER TABLE kategoria_translation ADD CONSTRAINT kategoria_translation_id_kategoria_id FOREIGN KEY (id) REFERENCES kategoria(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE kategoria ADD CONSTRAINT kategoria_id_usera_sf_guard_user_id FOREIGN KEY (id_usera) REFERENCES sf_guard_user(id);
ALTER TABLE komentarz_bloga ADD CONSTRAINT komentarz_bloga_id_bloga_blog_id FOREIGN KEY (id_bloga) REFERENCES blog(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE komentarz_kategorii ADD CONSTRAINT komentarz_kategorii_id_kategorii_kategoria_id FOREIGN KEY (id_kategorii) REFERENCES kategoria(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE kontakt_translation ADD CONSTRAINT kontakt_translation_id_kontakt_id FOREIGN KEY (id) REFERENCES kontakt(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE kontakt ADD CONSTRAINT kontakt_id_usera_sf_guard_user_id FOREIGN KEY (id_usera) REFERENCES sf_guard_user(id);
ALTER TABLE news_translation ADD CONSTRAINT news_translation_id_news_id FOREIGN KEY (id) REFERENCES news(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE news ADD CONSTRAINT news_id_usera_sf_guard_user_id FOREIGN KEY (id_usera) REFERENCES sf_guard_user(id);
ALTER TABLE o_mnie_translation ADD CONSTRAINT o_mnie_translation_id_o_mnie_id FOREIGN KEY (id) REFERENCES o_mnie(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE o_mnie ADD CONSTRAINT o_mnie_id_usera_sf_guard_user_id FOREIGN KEY (id_usera) REFERENCES sf_guard_user(id);
ALTER TABLE strona_glowna_translation ADD CONSTRAINT strona_glowna_translation_id_strona_glowna_id FOREIGN KEY (id) REFERENCES strona_glowna(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE strona_glowna ADD CONSTRAINT strona_glowna_id_usera_sf_guard_user_id FOREIGN KEY (id_usera) REFERENCES sf_guard_user(id);
ALTER TABLE szkocja_translation ADD CONSTRAINT szkocja_translation_id_szkocja_id FOREIGN KEY (id) REFERENCES szkocja(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE szkocja ADD CONSTRAINT szkocja_id_usera_sf_guard_user_id FOREIGN KEY (id_usera) REFERENCES sf_guard_user(id);
ALTER TABLE tv_translation ADD CONSTRAINT tv_translation_id_tv_id FOREIGN KEY (id) REFERENCES tv(id) ON UPDATE CASCADE ON DELETE CASCADE;
ALTER TABLE tv ADD CONSTRAINT tv_id_usera_sf_guard_user_id FOREIGN KEY (id_usera) REFERENCES sf_guard_user(id);
ALTER TABLE zdjecie ADD CONSTRAINT zdjecie_id_kategorii_kategoria_id FOREIGN KEY (id_kategorii) REFERENCES kategoria(id) ON UPDATE CASCADE 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;
