$this->addSql('CREATE SEQUENCE registration_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE useraccount_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE usergroupe_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE usermodo_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE whitelist_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE SEQUENCE widget_id_seq INCREMENT BY 1 MINVALUE 1 START 1');
$this->addSql('CREATE TABLE alert (id INT NOT NULL, category INT NOT NULL, title VARCHAR(100) NOT NULL, content TEXT DEFAULT NULL, rowOrder INT DEFAULT NULL, publishedat DATE NOT NULL, unpublishedat DATE DEFAULT NULL, fghideable BOOLEAN NOT NULL, roles TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_17FD46C164C19C1 ON alert (category)');
$this->addSql('COMMENT ON COLUMN alert.roles IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE alertgroupe (alert INT NOT NULL, groupe INT NOT NULL, PRIMARY KEY(alert, groupe))');
$this->addSql('CREATE INDEX IDX_64DB975617FD46C1 ON alertgroupe (alert)');
$this->addSql('CREATE INDEX IDX_64DB97564B98C21 ON alertgroupe (groupe)');
$this->addSql('CREATE TABLE alertuserread (alert INT NOT NULL, useraccount INT NOT NULL, PRIMARY KEY(alert, useraccount))');
$this->addSql('CREATE INDEX IDX_D4317FA917FD46C1 ON alertuserread (alert)');
$this->addSql('CREATE INDEX IDX_D4317FA9E157AA1A ON alertuserread (useraccount)');
$this->addSql('CREATE TABLE alertcategory (id INT NOT NULL, icon_id INT DEFAULT NULL, label VARCHAR(100) NOT NULL, color VARCHAR(255) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_EC575F7E54B9D732 ON alertcategory (icon_id)');
$this->addSql('CREATE TABLE audit (id INT NOT NULL, entityname VARCHAR(250) NOT NULL, entityid VARCHAR(250) NOT NULL, datesubmit TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, username VARCHAR(250) NOT NULL, description TEXT DEFAULT NULL, detail TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX search_idx ON audit (entityname, entityid, datesubmit)');
$this->addSql('COMMENT ON COLUMN audit.detail IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE bookmark (id INT NOT NULL, icon_id INT DEFAULT NULL, user_id INT DEFAULT NULL, pagewidget_id INT DEFAULT NULL, item_id INT DEFAULT NULL, title VARCHAR(100) NOT NULL, subtitle VARCHAR(250) DEFAULT NULL, url VARCHAR(500) NOT NULL, target VARCHAR(32) NOT NULL, rowOrder INT DEFAULT NULL, color VARCHAR(24) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_DA62921D54B9D732 ON bookmark (icon_id)');
$this->addSql('CREATE INDEX IDX_DA62921DA76ED395 ON bookmark (user_id)');
$this->addSql('CREATE INDEX IDX_DA62921D55B7C7A2 ON bookmark (pagewidget_id)');
$this->addSql('CREATE INDEX IDX_DA62921D126F525E ON bookmark (item_id)');
$this->addSql('CREATE TABLE config (id VARCHAR(255) NOT NULL, title VARCHAR(250) NOT NULL, value TEXT DEFAULT NULL, defaultvalue TEXT NOT NULL, roworder VARCHAR(255) NOT NULL, visible BOOLEAN NOT NULL, changeable BOOLEAN NOT NULL, required BOOLEAN NOT NULL, type VARCHAR(255) NOT NULL, grouped VARCHAR(255) NOT NULL, category VARCHAR(255) NOT NULL, help TEXT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE cron (id INT NOT NULL, command VARCHAR(255) NOT NULL, description TEXT DEFAULT NULL, statut INT DEFAULT NULL, submitdate TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, startexecdate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, endexecdate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, nextexecdate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, repeatinterval INT DEFAULT NULL, jsonargument TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE groupe (id INT NOT NULL, owner_id INT DEFAULT NULL, pagetemplate_id INT DEFAULT NULL, label VARCHAR(250) NOT NULL, description TEXT DEFAULT NULL, email VARCHAR(250) DEFAULT NULL, isopen BOOLEAN DEFAULT false NOT NULL, isworkgroup BOOLEAN DEFAULT false NOT NULL, apikey VARCHAR(255) NOT NULL, ldapfilter TEXT DEFAULT NULL, attributes TEXT DEFAULT NULL, idexternal TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_4B98C21EA750E8 ON groupe (label)');
$this->addSql('CREATE INDEX IDX_4B98C217E3C61F9 ON groupe (owner_id)');
$this->addSql('CREATE INDEX IDX_4B98C216D71CE5E ON groupe (pagetemplate_id)');
$this->addSql('CREATE TABLE icon (id INT NOT NULL, user_id INT DEFAULT NULL, label VARCHAR(250) NOT NULL, tags VARCHAR(250) DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_659429DBEA750E8 ON icon (label)');
$this->addSql('CREATE INDEX IDX_659429DBA76ED395 ON icon (user_id)');
$this->addSql('CREATE TABLE item (id INT NOT NULL, icon_id INT DEFAULT NULL, category INT NOT NULL, title VARCHAR(100) NOT NULL, subtitle VARCHAR(250) DEFAULT NULL, slug VARCHAR(128) DEFAULT NULL, url VARCHAR(500) NOT NULL, target VARCHAR(32) NOT NULL, content TEXT DEFAULT NULL, rowOrder INT DEFAULT NULL, essential BOOLEAN DEFAULT false, protected BOOLEAN DEFAULT false, color VARCHAR(24) DEFAULT NULL, roles TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1F1B251E989D9B62 ON item (slug)');
$this->addSql('CREATE INDEX IDX_1F1B251E54B9D732 ON item (icon_id)');
$this->addSql('CREATE INDEX IDX_1F1B251E64C19C1 ON item (category)');
$this->addSql('COMMENT ON COLUMN item.roles IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE itemgroupe (item INT NOT NULL, groupe INT NOT NULL, PRIMARY KEY(item, groupe))');
$this->addSql('CREATE INDEX IDX_A4267B6D1F1B251E ON itemgroupe (item)');
$this->addSql('CREATE INDEX IDX_A4267B6D4B98C21 ON itemgroupe (groupe)');
$this->addSql('CREATE TABLE itemcategory (id INT NOT NULL, icon_id INT DEFAULT NULL, label VARCHAR(100) NOT NULL, color VARCHAR(24) DEFAULT NULL, rowOrder INT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_7959DEE854B9D732 ON itemcategory (icon_id)');
$this->addSql('CREATE TABLE niveau01 (id INT NOT NULL, label VARCHAR(250) NOT NULL, code TEXT DEFAULT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, email VARCHAR(60) DEFAULT NULL, apikey VARCHAR(255) NOT NULL, ldapfilter TEXT DEFAULT NULL, attributes TEXT DEFAULT NULL, idexternal TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_6DFC7E23EA750E8 ON niveau01 (label)');
$this->addSql('CREATE TABLE niveau02 (id INT NOT NULL, niveau01_id INT NOT NULL, label VARCHAR(250) NOT NULL, code TEXT DEFAULT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, email VARCHAR(60) DEFAULT NULL, apikey VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_F4F52F99EA750E8 ON niveau02 (label)');
$this->addSql('CREATE INDEX IDX_F4F52F9959FDD7AB ON niveau02 (niveau01_id)');
$this->addSql('CREATE TABLE niveau03 (id INT NOT NULL, niveau02_id INT NOT NULL, label VARCHAR(250) NOT NULL, code TEXT DEFAULT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, email VARCHAR(60) DEFAULT NULL, apikey VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_83F21F0FEA750E8 ON niveau03 (label)');
$this->addSql('CREATE INDEX IDX_83F21F0F4B487845 ON niveau03 (niveau02_id)');
$this->addSql('CREATE TABLE niveau04 (id INT NOT NULL, niveau03_id INT NOT NULL, label VARCHAR(250) NOT NULL, code TEXT DEFAULT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, email VARCHAR(60) DEFAULT NULL, apikey VARCHAR(255) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_1D968AACEA750E8 ON niveau04 (label)');
$this->addSql('CREATE INDEX IDX_1D968AACF3F41F20 ON niveau04 (niveau03_id)');
$this->addSql('CREATE TABLE page (id INT NOT NULL, pagecategory_id INT DEFAULT NULL, user_id INT DEFAULT NULL, page_id INT DEFAULT NULL, name VARCHAR(100) NOT NULL, roworder INT NOT NULL, maxwidth INT NOT NULL, fonticon VARCHAR(255) DEFAULT NULL, url TEXT DEFAULT NULL, toreload BOOLEAN DEFAULT NULL, html TEXT DEFAULT NULL, template TEXT DEFAULT NULL, parentfor VARCHAR(255) DEFAULT NULL, roles TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_140AB6207AED5C04 ON page (pagecategory_id)');
$this->addSql('CREATE INDEX IDX_140AB620A76ED395 ON page (user_id)');
$this->addSql('CREATE INDEX IDX_140AB620C4663E4 ON page (page_id)');
$this->addSql('COMMENT ON COLUMN page.template IS \'(DC2Type:array)\'');
$this->addSql('COMMENT ON COLUMN page.roles IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE pagegroupe (page INT NOT NULL, groupe INT NOT NULL, PRIMARY KEY(page, groupe))');
$this->addSql('CREATE INDEX IDX_E8009F6B140AB620 ON pagegroupe (page)');
$this->addSql('CREATE INDEX IDX_E8009F6B4B98C21 ON pagegroupe (groupe)');
$this->addSql('CREATE TABLE pagecategory (id INT NOT NULL, name VARCHAR(100) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE TABLE pagewidget (id INT NOT NULL, page_id INT DEFAULT NULL, widget_id INT DEFAULT NULL, icon_id INT DEFAULT NULL, name VARCHAR(100) NOT NULL, loc VARCHAR(255) NOT NULL, roworder INT NOT NULL, height INT NOT NULL, autoajust BOOLEAN DEFAULT false NOT NULL, border BOOLEAN DEFAULT true NOT NULL, opened BOOLEAN DEFAULT true NOT NULL, viewheader BOOLEAN DEFAULT true NOT NULL, colorheaderback VARCHAR(255) DEFAULT NULL, colorheaderfont VARCHAR(255) DEFAULT NULL, colorbodyback VARCHAR(255) DEFAULT NULL, colorbodyfont VARCHAR(255) DEFAULT NULL, parameter TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_69400D9AC4663E4 ON pagewidget (page_id)');
$this->addSql('CREATE INDEX IDX_69400D9AFBE885E2 ON pagewidget (widget_id)');
$this->addSql('CREATE INDEX IDX_69400D9A54B9D732 ON pagewidget (icon_id)');
$this->addSql('COMMENT ON COLUMN pagewidget.parameter IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE registration (id INT NOT NULL, niveau01_id INT NOT NULL, niveau02_id INT DEFAULT NULL, niveau03_id INT DEFAULT NULL, niveau04_id INT DEFAULT NULL, username VARCHAR(128) NOT NULL, firstname VARCHAR(250) DEFAULT NULL, lastname VARCHAR(250) DEFAULT NULL, password VARCHAR(250) NOT NULL, salt VARCHAR(250) NOT NULL, email VARCHAR(128) NOT NULL, isvisible BOOLEAN NOT NULL, postaladress VARCHAR(250) DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, job VARCHAR(250) DEFAULT NULL, position VARCHAR(250) DEFAULT NULL, motivation TEXT DEFAULT NULL, note TEXT DEFAULT NULL, keyexpire TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, keyvalue VARCHAR(60) DEFAULT NULL, statut INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_62A8A7A7F85E0677 ON registration (username)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_62A8A7A7E7927C74 ON registration (email)');
$this->addSql('CREATE INDEX IDX_62A8A7A759FDD7AB ON registration (niveau01_id)');
$this->addSql('CREATE INDEX IDX_62A8A7A74B487845 ON registration (niveau02_id)');
$this->addSql('CREATE INDEX IDX_62A8A7A7F3F41F20 ON registration (niveau03_id)');
$this->addSql('CREATE INDEX IDX_62A8A7A76E232799 ON registration (niveau04_id)');
$this->addSql('CREATE TABLE useraccount (id INT NOT NULL, niveau01_id INT NOT NULL, niveau02_id INT DEFAULT NULL, niveau03_id INT DEFAULT NULL, niveau04_id INT DEFAULT NULL, username VARCHAR(128) NOT NULL, apikey VARCHAR(255) NOT NULL, firstname VARCHAR(250) DEFAULT NULL, lastname VARCHAR(250) DEFAULT NULL, roles TEXT NOT NULL, password VARCHAR(250) NOT NULL, salt VARCHAR(250) NOT NULL, isactive BOOLEAN NOT NULL, email VARCHAR(128) NOT NULL, avatar VARCHAR(250) DEFAULT \'0\', isvisible BOOLEAN NOT NULL, postaladress TEXT DEFAULT NULL, telephonenumber VARCHAR(60) DEFAULT NULL, job VARCHAR(250) DEFAULT NULL, position VARCHAR(250) DEFAULT NULL, motivation TEXT DEFAULT NULL, note TEXT DEFAULT NULL, preference TEXT DEFAULT NULL, keyexpire TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, keyvalue VARCHAR(60) DEFAULT NULL, visitedate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, visitecpt INT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_E157AA1AF85E0677 ON useraccount (username)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_E157AA1AE7927C74 ON useraccount (email)');
$this->addSql('CREATE INDEX IDX_E157AA1A59FDD7AB ON useraccount (niveau01_id)');
$this->addSql('CREATE INDEX IDX_E157AA1A4B487845 ON useraccount (niveau02_id)');
$this->addSql('CREATE INDEX IDX_E157AA1AF3F41F20 ON useraccount (niveau03_id)');
$this->addSql('CREATE INDEX IDX_E157AA1A6E232799 ON useraccount (niveau04_id)');
$this->addSql('COMMENT ON COLUMN useraccount.roles IS \'(DC2Type:array)\'');
$this->addSql('COMMENT ON COLUMN useraccount.preference IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE usergroupe (id INT NOT NULL, user_id INT DEFAULT NULL, group_id INT DEFAULT NULL, rolegroup INT NOT NULL, apikey VARCHAR(60) NOT NULL, visitedate TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, visitecpt INT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_6C439BE5A76ED395 ON usergroupe (user_id)');
$this->addSql('CREATE INDEX IDX_6C439BE5FE54D947 ON usergroupe (group_id)');
$this->addSql('CREATE UNIQUE INDEX UNIQ_6C439BE5A76ED395FE54D947 ON usergroupe (user_id, group_id)');
$this->addSql('CREATE TABLE usermodo (id INT NOT NULL, user_id INT NOT NULL, niveau01_id INT NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_D162D6C4A76ED395 ON usermodo (user_id)');
$this->addSql('CREATE INDEX IDX_D162D6C459FDD7AB ON usermodo (niveau01_id)');
$this->addSql('CREATE TABLE whitelist (id INT NOT NULL, label VARCHAR(250) NOT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE UNIQUE INDEX UNIQ_CB069864EA750E8 ON whitelist (label)');
$this->addSql('CREATE TABLE widget (id INT NOT NULL, icon_id INT DEFAULT NULL, roworder INT NOT NULL, name VARCHAR(100) NOT NULL, description TEXT DEFAULT NULL, routeview VARCHAR(255) NOT NULL, height INT NOT NULL, autoajust BOOLEAN DEFAULT false NOT NULL, border BOOLEAN DEFAULT true NOT NULL, opened BOOLEAN DEFAULT true NOT NULL, viewheader BOOLEAN DEFAULT true NOT NULL, colorheaderback VARCHAR(255) DEFAULT NULL, colorheaderfont VARCHAR(255) DEFAULT NULL, colorbodyback VARCHAR(255) DEFAULT NULL, colorbodyfont VARCHAR(255) DEFAULT NULL, access TEXT DEFAULT NULL, parameter TEXT DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_85F91ED054B9D732 ON widget (icon_id)');
$this->addSql('COMMENT ON COLUMN widget.access IS \'(DC2Type:array)\'');
$this->addSql('COMMENT ON COLUMN widget.parameter IS \'(DC2Type:array)\'');
$this->addSql('CREATE TABLE messenger_messages (id BIGSERIAL NOT NULL, body TEXT NOT NULL, headers TEXT NOT NULL, queue_name VARCHAR(190) NOT NULL, created_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, available_at TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, delivered_at TIMESTAMP(0) WITHOUT TIME ZONE DEFAULT NULL, PRIMARY KEY(id))');
$this->addSql('CREATE INDEX IDX_75EA56E0FB7336F0 ON messenger_messages (queue_name)');
$this->addSql('CREATE INDEX IDX_75EA56E0E3BD61CE ON messenger_messages (available_at)');
$this->addSql('CREATE INDEX IDX_75EA56E016BA31DB ON messenger_messages (delivered_at)');
$this->addSql('DROP TRIGGER IF EXISTS notify_trigger ON messenger_messages;');
$this->addSql('CREATE TRIGGER notify_trigger AFTER INSERT OR UPDATE ON messenger_messages FOR EACH ROW EXECUTE PROCEDURE notify_messenger_messages();');
$this->addSql('ALTER TABLE alert ADD CONSTRAINT FK_17FD46C164C19C1 FOREIGN KEY (category) REFERENCES alertcategory (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE groupe ADD CONSTRAINT FK_4B98C217E3C61F9 FOREIGN KEY (owner_id) REFERENCES useraccount (id) ON DELETE SET NULL NOT DEFERRABLE INITIALLY IMMEDIATE');
$this->addSql('ALTER TABLE groupe ADD CONSTRAINT FK_4B98C216D71CE5E FOREIGN KEY (pagetemplate_id) REFERENCES page (id) NOT DEFERRABLE INITIALLY IMMEDIATE');