diff --git a/migrations/Version20241114132304.php b/migrations/Version20241114132304.php new file mode 100644 index 0000000..e87512c --- /dev/null +++ b/migrations/Version20241114132304.php @@ -0,0 +1,110 @@ +addSql('CREATE SEQUENCE degree_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE faq_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE intern_application_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE intern_degree_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE intern_favorite_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE intern_skill_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE message_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE SEQUENCE skill_id_seq INCREMENT BY 1 MINVALUE 1 START 1'); + $this->addSql('CREATE TABLE degree (id INT NOT NULL, label VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE TABLE faq (id INT NOT NULL, question TEXT NOT NULL, answer TEXT DEFAULT NULL, update_date DATE NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE TABLE intern_application (id INT NOT NULL, application_id INT DEFAULT NULL, intern_id INT DEFAULT NULL, application_date DATE NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_4EDBBCC83E030ACD ON intern_application (application_id)'); + $this->addSql('CREATE INDEX IDX_4EDBBCC8525DD4B4 ON intern_application (intern_id)'); + $this->addSql('CREATE TABLE intern_degree (id INT NOT NULL, degree_id INT DEFAULT NULL, intern_id INT DEFAULT NULL, graduation_date DATE NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_E68CCB23B35C5756 ON intern_degree (degree_id)'); + $this->addSql('CREATE INDEX IDX_E68CCB23525DD4B4 ON intern_degree (intern_id)'); + $this->addSql('CREATE TABLE intern_favorite (id INT NOT NULL, announcement_id INT DEFAULT NULL, intern_id INT DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_A709862E913AEA17 ON intern_favorite (announcement_id)'); + $this->addSql('CREATE INDEX IDX_A709862E525DD4B4 ON intern_favorite (intern_id)'); + $this->addSql('CREATE TABLE intern_skill (id INT NOT NULL, skill_id INT DEFAULT NULL, intern_id INT DEFAULT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_75E1C4DC5585C142 ON intern_skill (skill_id)'); + $this->addSql('CREATE INDEX IDX_75E1C4DC525DD4B4 ON intern_skill (intern_id)'); + $this->addSql('CREATE TABLE message (id INT NOT NULL, sender_id INT DEFAULT NULL, receiver_id INT DEFAULT NULL, content TEXT NOT NULL, sending_date TIMESTAMP(0) WITHOUT TIME ZONE NOT NULL, PRIMARY KEY(id))'); + $this->addSql('CREATE INDEX IDX_B6BD307FF624B39D ON message (sender_id)'); + $this->addSql('CREATE INDEX IDX_B6BD307FCD53EDB6 ON message (receiver_id)'); + $this->addSql('CREATE TABLE skill (id INT NOT NULL, label VARCHAR(255) NOT NULL, PRIMARY KEY(id))'); + $this->addSql('ALTER TABLE intern_application ADD CONSTRAINT FK_4EDBBCC83E030ACD FOREIGN KEY (application_id) REFERENCES announcement (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE intern_application ADD CONSTRAINT FK_4EDBBCC8525DD4B4 FOREIGN KEY (intern_id) REFERENCES intern (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE intern_degree ADD CONSTRAINT FK_E68CCB23B35C5756 FOREIGN KEY (degree_id) REFERENCES degree (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE intern_degree ADD CONSTRAINT FK_E68CCB23525DD4B4 FOREIGN KEY (intern_id) REFERENCES intern (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE intern_favorite ADD CONSTRAINT FK_A709862E913AEA17 FOREIGN KEY (announcement_id) REFERENCES announcement (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE intern_favorite ADD CONSTRAINT FK_A709862E525DD4B4 FOREIGN KEY (intern_id) REFERENCES intern (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE intern_skill ADD CONSTRAINT FK_75E1C4DC5585C142 FOREIGN KEY (skill_id) REFERENCES skill (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE intern_skill ADD CONSTRAINT FK_75E1C4DC525DD4B4 FOREIGN KEY (intern_id) REFERENCES intern (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307FF624B39D FOREIGN KEY (sender_id) REFERENCES userApp (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE message ADD CONSTRAINT FK_B6BD307FCD53EDB6 FOREIGN KEY (receiver_id) REFERENCES userApp (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE favorites DROP CONSTRAINT fk_e46960f5525dd4b4'); + $this->addSql('ALTER TABLE favorites DROP CONSTRAINT fk_e46960f5913aea17'); + $this->addSql('ALTER TABLE applications DROP CONSTRAINT fk_f7c966f0525dd4b4'); + $this->addSql('ALTER TABLE applications DROP CONSTRAINT fk_f7c966f0913aea17'); + $this->addSql('DROP TABLE favorites'); + $this->addSql('DROP TABLE applications'); + $this->addSql('ALTER TABLE announcement ADD creation_date DATE NOT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE SCHEMA public'); + $this->addSql('DROP SEQUENCE degree_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE faq_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE intern_application_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE intern_degree_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE intern_favorite_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE intern_skill_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE message_id_seq CASCADE'); + $this->addSql('DROP SEQUENCE skill_id_seq CASCADE'); + $this->addSql('CREATE TABLE favorites (intern_id INT NOT NULL, announcement_id INT NOT NULL, PRIMARY KEY(intern_id, announcement_id))'); + $this->addSql('CREATE INDEX idx_e46960f5913aea17 ON favorites (announcement_id)'); + $this->addSql('CREATE INDEX idx_e46960f5525dd4b4 ON favorites (intern_id)'); + $this->addSql('CREATE TABLE applications (intern_id INT NOT NULL, announcement_id INT NOT NULL, PRIMARY KEY(intern_id, announcement_id))'); + $this->addSql('CREATE INDEX idx_f7c966f0913aea17 ON applications (announcement_id)'); + $this->addSql('CREATE INDEX idx_f7c966f0525dd4b4 ON applications (intern_id)'); + $this->addSql('ALTER TABLE favorites ADD CONSTRAINT fk_e46960f5525dd4b4 FOREIGN KEY (intern_id) REFERENCES intern (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE favorites ADD CONSTRAINT fk_e46960f5913aea17 FOREIGN KEY (announcement_id) REFERENCES announcement (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE applications ADD CONSTRAINT fk_f7c966f0525dd4b4 FOREIGN KEY (intern_id) REFERENCES intern (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE applications ADD CONSTRAINT fk_f7c966f0913aea17 FOREIGN KEY (announcement_id) REFERENCES announcement (id) ON DELETE CASCADE NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('ALTER TABLE intern_application DROP CONSTRAINT FK_4EDBBCC83E030ACD'); + $this->addSql('ALTER TABLE intern_application DROP CONSTRAINT FK_4EDBBCC8525DD4B4'); + $this->addSql('ALTER TABLE intern_degree DROP CONSTRAINT FK_E68CCB23B35C5756'); + $this->addSql('ALTER TABLE intern_degree DROP CONSTRAINT FK_E68CCB23525DD4B4'); + $this->addSql('ALTER TABLE intern_favorite DROP CONSTRAINT FK_A709862E913AEA17'); + $this->addSql('ALTER TABLE intern_favorite DROP CONSTRAINT FK_A709862E525DD4B4'); + $this->addSql('ALTER TABLE intern_skill DROP CONSTRAINT FK_75E1C4DC5585C142'); + $this->addSql('ALTER TABLE intern_skill DROP CONSTRAINT FK_75E1C4DC525DD4B4'); + $this->addSql('ALTER TABLE message DROP CONSTRAINT FK_B6BD307FF624B39D'); + $this->addSql('ALTER TABLE message DROP CONSTRAINT FK_B6BD307FCD53EDB6'); + $this->addSql('DROP TABLE degree'); + $this->addSql('DROP TABLE faq'); + $this->addSql('DROP TABLE intern_application'); + $this->addSql('DROP TABLE intern_degree'); + $this->addSql('DROP TABLE intern_favorite'); + $this->addSql('DROP TABLE intern_skill'); + $this->addSql('DROP TABLE message'); + $this->addSql('DROP TABLE skill'); + $this->addSql('ALTER TABLE announcement DROP creation_date'); + } +} diff --git a/migrations/Version20241121135116.php b/migrations/Version20241121135116.php new file mode 100644 index 0000000..c932e51 --- /dev/null +++ b/migrations/Version20241121135116.php @@ -0,0 +1,32 @@ +addSql('ALTER TABLE userapp ALTER roles DROP NOT NULL'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE SCHEMA public'); + $this->addSql('ALTER TABLE userApp ALTER roles SET NOT NULL'); + } +} diff --git a/migrations/Version20241121140219.php b/migrations/Version20241121140219.php new file mode 100644 index 0000000..28107a4 --- /dev/null +++ b/migrations/Version20241121140219.php @@ -0,0 +1,38 @@ +addSql('ALTER TABLE announcement DROP CONSTRAINT fk_4db9d91c6bf700bd'); + $this->addSql('DROP INDEX idx_4db9d91c6bf700bd'); + $this->addSql('ALTER TABLE announcement ADD status VARCHAR(255) NOT NULL'); + $this->addSql('ALTER TABLE announcement DROP status_id'); + } + + public function down(Schema $schema): void + { + // this down() migration is auto-generated, please modify it to your needs + $this->addSql('CREATE SCHEMA public'); + $this->addSql('ALTER TABLE announcement ADD status_id INT NOT NULL'); + $this->addSql('ALTER TABLE announcement DROP status'); + $this->addSql('ALTER TABLE announcement ADD CONSTRAINT fk_4db9d91c6bf700bd FOREIGN KEY (status_id) REFERENCES status (id) NOT DEFERRABLE INITIALLY IMMEDIATE'); + $this->addSql('CREATE INDEX idx_4db9d91c6bf700bd ON announcement (status_id)'); + } +} diff --git a/templates/announcement/add.html.twig b/templates/announcement/add.html.twig index 6171d29..73233c7 100644 --- a/templates/announcement/add.html.twig +++ b/templates/announcement/add.html.twig @@ -1,14 +1,4 @@ {% extends 'base.html.twig' %} - -{% block title %}Hello AnnouncementController!{% endblock %} - {% block body %} - - - {{ form(announcementForm) }} - - + {{ form(announcementForm) }} {% endblock %} \ No newline at end of file diff --git a/templates/announcement/list.html.twig b/templates/announcement/list.html.twig index d1d3c02..50912d2 100644 --- a/templates/announcement/list.html.twig +++ b/templates/announcement/list.html.twig @@ -13,8 +13,9 @@
{{ ann.description }}
+ ------------------------------ -{{ ann.creationDate }}
+{{ ann.creationDate|format("d-m-y") }}
{% endfor %} diff --git a/templates/base.html.twig b/templates/base.html.twig index ff7d2bf..80c70db 100644 --- a/templates/base.html.twig +++ b/templates/base.html.twig @@ -3,7 +3,7 @@ -