migrations/Version20250610103051.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. use Symfony\Component\Uid\Uuid;
  7. /**
  8.  * Auto-generated Migration: Please modify to your needs!
  9.  */
  10. final class Version20250610103051 extends AbstractMigration
  11. {
  12.     public function getDescription(): string
  13.     {
  14.         return 'Add guid VARCHAR(36) to app_academy and populate existing data based on title/language.';
  15.     }
  16.     public function up(Schema $schema): void
  17.     {
  18.         $this->addSql('ALTER TABLE app_academy ADD guid VARCHAR(36) NULL');
  19.         $this->addSql("UPDATE `app_academy` SET `guid` = '"Uuid::v6()->jsonSerialize() ."' WHERE `title` = 'Trades University' AND `language` = 'ar'");
  20.         $this->addSql("UPDATE `app_academy` SET `guid` = '"Uuid::v6()->jsonSerialize() ."' WHERE `title` = 'Immo University' AND `language` = 'ar'");
  21.         $this->addSql("UPDATE `app_academy` SET `guid` = '"Uuid::v6()->jsonSerialize() ."' WHERE `title` = 'Crypto University' AND `language` = 'ar'");
  22.         $this->addSql("UPDATE `app_academy` SET `guid` = '"Uuid::v6()->jsonSerialize() ."' WHERE `title` = 'Bourse University' AND `language` = 'ar'");
  23.         $this->addSql("UPDATE `app_academy` SET `guid` = '"Uuid::v6()->jsonSerialize() ."' WHERE `title` = 'Trades University' AND `language` = 'en'");
  24.         $this->addSql("UPDATE `app_academy` SET `guid` = '"Uuid::v6()->jsonSerialize() ."' WHERE `title` = 'Immo University' AND `language` = 'en'");
  25.         $this->addSql("UPDATE `app_academy` SET `guid` = '"Uuid::v6()->jsonSerialize() ."' WHERE `title` = 'Crypto University' AND `language` = 'en'");
  26.         $this->addSql("UPDATE `app_academy` SET `guid` = '"Uuid::v6()->jsonSerialize() ."' WHERE `title` = 'Bourse University' AND `language` = 'en'");
  27.         $this->addSql("UPDATE `app_academy` SET `guid` = '"Uuid::v6()->jsonSerialize() ."' WHERE `title` = 'Trades University' AND `language` = 'es'");
  28.         $this->addSql("UPDATE `app_academy` SET `guid` = '"Uuid::v6()->jsonSerialize() ."' WHERE `title` = 'Immo University' AND `language` = 'es'");
  29.         $this->addSql("UPDATE `app_academy` SET `guid` = '"Uuid::v6()->jsonSerialize() ."' WHERE `title` = 'Crypto University' AND `language` = 'es'");
  30.         $this->addSql("UPDATE `app_academy` SET `guid` = '"Uuid::v6()->jsonSerialize() ."' WHERE `title` = 'Bourse University' AND `language` = 'es'");
  31.         $this->addSql("UPDATE `app_academy` SET `guid` = '"Uuid::v6()->jsonSerialize() ."' WHERE `title` = 'Trades University' AND `language` = 'fr'");
  32.         $this->addSql("UPDATE `app_academy` SET `guid` = '"Uuid::v6()->jsonSerialize() ."' WHERE `title` = 'Immo University' AND `language` = 'fr'");
  33.         $this->addSql("UPDATE `app_academy` SET `guid` = '"Uuid::v6()->jsonSerialize() ."' WHERE `title` = 'Crypto University' AND `language` = 'fr'");
  34.         $this->addSql("UPDATE `app_academy` SET `guid` = '"Uuid::v6()->jsonSerialize() ."' WHERE `title` = 'Bourse University' AND `language` = 'fr'");
  35.         $this->addSql("UPDATE `app_academy` SET `guid` = '"Uuid::v6()->jsonSerialize() ."' WHERE `title` = 'Tes premiers pas avec Mybiz' AND `language` = 'fr'");
  36.         $this->addSql('CREATE UNIQUE INDEX UNIQ_74108E862B6FCFB2 ON app_academy (guid)');
  37.         $this->addSql('ALTER TABLE app_media_content ADD duration INT DEFAULT NULL');
  38.         $this->addSql('ALTER TABLE app_media_content ADD thumbnail VARCHAR(255) DEFAULT NULL');
  39.         // Ecom Academy
  40.         $this->addSql("INSERT INTO `app_feature_type` (`name`, `color`, `is_enabled`, `marketing_name`, `space_id`) VALUES ('ecom', '#25893F', 1, 'Ecom', (SELECT `id` from `app_space` WHERE `name` = 'futures_infinity'));");
  41.         $this->addSql("SET @feature_type_id = LAST_INSERT_ID();");
  42.         $this->addSql("INSERT INTO `app_feature` (`feature_type_id`, `name`, `is_enabled`, `image`, `is_bundle`, `type`, `translation_key`) VALUES (@feature_type_id, 'Ecom University', 1, NULL, 0, 'university', '');");
  43.         $this->addSql("SET @feature_id = LAST_INSERT_ID();");
  44.         // FR
  45.         $academyGuid Uuid::v6()->jsonSerialize();
  46.         $this->addSql("INSERT INTO `app_academy` (`feature_id`, `title`, `description`, `is_enabled`, `language`, `educator_id`, `guid`) VALUES (@feature_id, 'Ecom Academy', '', 1, 'fr', (SELECT `id` from `app_user` WHERE `email` = 'mathieu.roccia@futures-infinity.com'), '" $academyGuid "')");
  47.         $this->addSql("SET @academy_id = LAST_INSERT_ID();");
  48.         $this->addSql("INSERT INTO `app_academy_chapter` (`academy_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@academy_id, NULL, '', 1, 1)");
  49.         $this->addSql("SET @chapter_id = LAST_INSERT_ID();");
  50.         $this->addSql("INSERT INTO `app_academy_sub_chapter` (`academy_chapter_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@chapter_id, 'MODULE 1', 'Les clés pour réussir durablement', 1, 1)");
  51.         $this->addSql("SET @sub_chapter_id = LAST_INSERT_ID();");
  52.         $this->addSql("INSERT INTO `app_academy_category` (`academy_sub_chapter_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@sub_chapter_id, 'Premiers pas avec Ecom Académie', '', 5, 1)");
  53.         $this->addSql("SET @category_id = LAST_INSERT_ID();");
  54.         $mediaGuid Uuid::v6()->jsonSerialize();
  55.         $this->addSql("INSERT INTO `app_media_content` (`academy_category_id`, `feature_tutorial_id`, `book_id`, `guid`, `position`, `title`, `description`, `is_enabled`, `is_required`, `url`, `type`, `link`, `text`, `duration`, `thumbnail`) VALUES (@category_id, NULL, NULL, '" $mediaGuid "', 5, '1.1 - Bienvenue dans l\'académie Ecom !', '', 1, 0, '', 'media_content_video', 'https://player.vimeo.com/video/1086212588', NULL, 194, 'https://i.vimeocdn.com/video/2017936484-da665916df4d2f97f31c47a84018224794f40e5b9fb53d23ab34c49ad3dddee2-d_640?region=us')");
  56.         // EN
  57.         $academyGuid Uuid::v6()->jsonSerialize();
  58.         $this->addSql("INSERT INTO `app_academy` (`feature_id`, `title`, `description`, `is_enabled`, `language`, `educator_id`, `guid`) VALUES (@feature_id, 'Ecom Academy', '', 1, 'en', (SELECT `id` from `app_user` WHERE `email` = 'mathieu.roccia@futures-infinity.com'), '" $academyGuid "')");
  59.         $this->addSql("SET @academy_id = LAST_INSERT_ID();");
  60.         $this->addSql("INSERT INTO `app_academy_chapter` (`academy_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@academy_id, NULL, '', 1, 1)");
  61.         $this->addSql("SET @chapter_id = LAST_INSERT_ID();");
  62.         $this->addSql("INSERT INTO `app_academy_sub_chapter` (`academy_chapter_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@chapter_id, 'MODULE 1', 'Keys to sustainable success', 1, 1)");
  63.         $this->addSql("SET @sub_chapter_id = LAST_INSERT_ID();");
  64.         $this->addSql("INSERT INTO `app_academy_category` (`academy_sub_chapter_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@sub_chapter_id, 'First steps with Ecom Academy', '', 5, 1)");
  65.         $this->addSql("SET @category_id = LAST_INSERT_ID();");
  66.         $mediaGuid Uuid::v6()->jsonSerialize();
  67.         $this->addSql("INSERT INTO `app_media_content` (`academy_category_id`, `feature_tutorial_id`, `book_id`, `guid`, `position`, `title`, `description`, `is_enabled`, `is_required`, `url`, `type`, `link`, `text`, `duration`, `thumbnail`) VALUES (@category_id, NULL, NULL, '" $mediaGuid "', 5, '1.1 - Welcome to the Ecom Academy!', '', 1, 0, '', 'media_content_video', 'https://player.vimeo.com/video/1086212588', NULL, 194, 'https://i.vimeocdn.com/video/2017936484-da665916df4d2f97f31c47a84018224794f40e5b9fb53d23ab34c49ad3dddee2-d_640?region=us')");
  68.         // ES
  69.         $academyGuid Uuid::v6()->jsonSerialize();
  70.         $this->addSql("INSERT INTO `app_academy` (`feature_id`, `title`, `description`, `is_enabled`, `language`, `educator_id`, `guid`) VALUES (@feature_id, 'Ecom Academy', '', 1, 'es', (SELECT `id` from `app_user` WHERE `email` = 'mathieu.roccia@futures-infinity.com'), '" $academyGuid "')");
  71.         $this->addSql("SET @academy_id = LAST_INSERT_ID();");
  72.         $this->addSql("INSERT INTO `app_academy_chapter` (`academy_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@academy_id, NULL, '', 1, 1)");
  73.         $this->addSql("SET @chapter_id = LAST_INSERT_ID();");
  74.         $this->addSql("INSERT INTO `app_academy_sub_chapter` (`academy_chapter_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@chapter_id, 'MÓDULO 1', 'Claves para el éxito sostenible', 1, 1)");
  75.         $this->addSql("SET @sub_chapter_id = LAST_INSERT_ID();");
  76.         $this->addSql("INSERT INTO `app_academy_category` (`academy_sub_chapter_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@sub_chapter_id, 'Primeros pasos con Ecom Academy', '', 5, 1)");
  77.         $this->addSql("SET @category_id = LAST_INSERT_ID();");
  78.         $mediaGuid Uuid::v6()->jsonSerialize();
  79.         $this->addSql("INSERT INTO `app_media_content` (`academy_category_id`, `feature_tutorial_id`, `book_id`, `guid`, `position`, `title`, `description`, `is_enabled`, `is_required`, `url`, `type`, `link`, `text`, `duration`, `thumbnail`) VALUES (@category_id, NULL, NULL, '" $mediaGuid "', 5, '1.1 - ¡Bienvenido a la Ecom Academy!', '', 1, 0, '', 'media_content_video', 'https://player.vimeo.com/video/1086212588', NULL, 194, 'https://i.vimeocdn.com/video/2017936484-da665916df4d2f97f31c47a84018224794f40e5b9fb53d23ab34c49ad3dddee2-d_640?region=us')");
  80.         // AR
  81.         $academyGuid Uuid::v6()->jsonSerialize();
  82.         $this->addSql("INSERT INTO `app_academy` (`feature_id`, `title`, `description`, `is_enabled`, `language`, `educator_id`, `guid`) VALUES (@feature_id, 'Ecom Academy', '', 1, 'ar', (SELECT `id` from `app_user` WHERE `email` = 'mathieu.roccia@futures-infinity.com'), '" $academyGuid "')");
  83.         $this->addSql("SET @academy_id = LAST_INSERT_ID();");
  84.         $this->addSql("INSERT INTO `app_academy_chapter` (`academy_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@academy_id, NULL, '', 1, 1)");
  85.         $this->addSql("SET @chapter_id = LAST_INSERT_ID();");
  86.         $this->addSql("INSERT INTO `app_academy_sub_chapter` (`academy_chapter_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@chapter_id, 'الوحدة 1', 'مفاتيح النجاح المستدام', 1, 1)");
  87.         $this->addSql("SET @sub_chapter_id = LAST_INSERT_ID();");
  88.         $this->addSql("INSERT INTO `app_academy_category` (`academy_sub_chapter_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@sub_chapter_id, 'الخطوات الأولى مع Ecom Academy', '', 5, 1)");
  89.         $this->addSql("SET @category_id = LAST_INSERT_ID();");
  90.         $mediaGuid Uuid::v6()->jsonSerialize();
  91.         $this->addSql("INSERT INTO `app_media_content` (`academy_category_id`, `feature_tutorial_id`, `book_id`, `guid`, `position`, `title`, `description`, `is_enabled`, `is_required`, `url`, `type`, `link`, `text`, `duration`, `thumbnail`) VALUES (@category_id, NULL, NULL, '" $mediaGuid "', 5, '1.1 - مرحبًا بك في Ecom Academy!', '', 1, 0, '', 'media_content_video', 'https://player.vimeo.com/video/1086212588', NULL, 194, 'https://i.vimeocdn.com/video/2017936484-da665916df4d2f97f31c47a84018224794f40e5b9fb53d23ab34c49ad3dddee2-d_640?region=us')");
  92.         // Digital Academy
  93.         $this->addSql("INSERT INTO `app_feature_type` (`name`, `color`, `is_enabled`, `marketing_name`, `space_id`) VALUES ('digital', '#F60C3B', 1, 'Digital', (SELECT `id` from `app_space` WHERE `name` = 'futures_infinity'));");
  94.         $this->addSql("SET @feature_type_id = LAST_INSERT_ID();");
  95.         $this->addSql("INSERT INTO `app_feature` (`feature_type_id`, `name`, `is_enabled`, `image`, `is_bundle`, `type`, `translation_key`) VALUES (@feature_type_id, 'Digital University', 1, NULL, 0, 'university', '');");
  96.         $this->addSql("SET @feature_id = LAST_INSERT_ID();");
  97.         // FR
  98.         $academyGuid Uuid::v6()->jsonSerialize();
  99.         $this->addSql("INSERT INTO `app_academy` (`feature_id`, `title`, `description`, `is_enabled`, `language`, `educator_id`, `guid`) VALUES (@feature_id, 'Digital Academy', '', 1, 'fr', (SELECT `id` from `app_user` WHERE `email` = 'mathieu.roccia@futures-infinity.com'), '" $academyGuid "')");
  100.         $this->addSql("SET @academy_id = LAST_INSERT_ID();");
  101.         $this->addSql("INSERT INTO `app_academy_chapter` (`academy_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@academy_id, NULL, '', 1, 1)");
  102.         $this->addSql("SET @chapter_id = LAST_INSERT_ID();");
  103.         $this->addSql("INSERT INTO `app_academy_sub_chapter` (`academy_chapter_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@chapter_id, 'MODULE 1', 'Les clés pour réussir durablement', 1, 1)");
  104.         $this->addSql("SET @sub_chapter_id = LAST_INSERT_ID();");
  105.         $this->addSql("INSERT INTO `app_academy_category` (`academy_sub_chapter_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@sub_chapter_id, 'Premiers pas avec Digital Académie', '', 5, 1)");
  106.         $this->addSql("SET @category_id = LAST_INSERT_ID();");
  107.         $mediaGuid Uuid::v6()->jsonSerialize();
  108.         $this->addSql("INSERT INTO `app_media_content` (`academy_category_id`, `feature_tutorial_id`, `book_id`, `guid`, `position`, `title`, `description`, `is_enabled`, `is_required`, `url`, `type`, `link`, `text`, `duration`, `thumbnail`) VALUES (@category_id, NULL, NULL, '" $mediaGuid "', 5, '1.1 - Bienvenue dans l\'académie Digital !', '', 1, 0, '', 'media_content_video', 'https://player.vimeo.com/video/1086212588', NULL, 194, 'https://i.vimeocdn.com/video/2017936484-da665916df4d2f97f31c47a84018224794f40e5b9fb53d23ab34c49ad3dddee2-d_640?region=us')");
  109.         // EN
  110.         $academyGuid Uuid::v6()->jsonSerialize();
  111.         $this->addSql("INSERT INTO `app_academy` (`feature_id`, `title`, `description`, `is_enabled`, `language`, `educator_id`, `guid`) VALUES (@feature_id, 'Digital Academy', '', 1, 'en', (SELECT `id` from `app_user` WHERE `email` = 'mathieu.roccia@futures-infinity.com'), '" $academyGuid "')");
  112.         $this->addSql("SET @academy_id = LAST_INSERT_ID();");
  113.         $this->addSql("INSERT INTO `app_academy_chapter` (`academy_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@academy_id, NULL, '', 1, 1)");
  114.         $this->addSql("SET @chapter_id = LAST_INSERT_ID();");
  115.         $this->addSql("INSERT INTO `app_academy_sub_chapter` (`academy_chapter_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@chapter_id, 'MODULE 1', 'Keys to sustainable success', 1, 1)");
  116.         $this->addSql("SET @sub_chapter_id = LAST_INSERT_ID();");
  117.         $this->addSql("INSERT INTO `app_academy_category` (`academy_sub_chapter_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@sub_chapter_id, 'First steps with Digital Academy', '', 5, 1)");
  118.         $this->addSql("SET @category_id = LAST_INSERT_ID();");
  119.         $mediaGuid Uuid::v6()->jsonSerialize();
  120.         $this->addSql("INSERT INTO `app_media_content` (`academy_category_id`, `feature_tutorial_id`, `book_id`, `guid`, `position`, `title`, `description`, `is_enabled`, `is_required`, `url`, `type`, `link`, `text`, `duration`, `thumbnail`) VALUES (@category_id, NULL, NULL, '" $mediaGuid "', 5, '1.1 - Welcome to the Digital Academy!', '', 1, 0, '', 'media_content_video', 'https://player.vimeo.com/video/1086212588', NULL, 194, 'https://i.vimeocdn.com/video/2017936484-da665916df4d2f97f31c47a84018224794f40e5b9fb53d23ab34c49ad3dddee2-d_640?region=us')");
  121.         // ES
  122.         $academyGuid Uuid::v6()->jsonSerialize();
  123.         $this->addSql("INSERT INTO `app_academy` (`feature_id`, `title`, `description`, `is_enabled`, `language`, `educator_id`, `guid`) VALUES (@feature_id, 'Digital Academy', '', 1, 'es', (SELECT `id` from `app_user` WHERE `email` = 'mathieu.roccia@futures-infinity.com'), '" $academyGuid "')");
  124.         $this->addSql("SET @academy_id = LAST_INSERT_ID();");
  125.         $this->addSql("INSERT INTO `app_academy_chapter` (`academy_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@academy_id, NULL, '', 1, 1)");
  126.         $this->addSql("SET @chapter_id = LAST_INSERT_ID();");
  127.         $this->addSql("INSERT INTO `app_academy_sub_chapter` (`academy_chapter_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@chapter_id, 'MÓDULO 1', 'Claves para el éxito sostenible', 1, 1)");
  128.         $this->addSql("SET @sub_chapter_id = LAST_INSERT_ID();");
  129.         $this->addSql("INSERT INTO `app_academy_category` (`academy_sub_chapter_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@sub_chapter_id, 'Primeros pasos con Digital Academy', '', 5, 1)");
  130.         $this->addSql("SET @category_id = LAST_INSERT_ID();");
  131.         $mediaGuid Uuid::v6()->jsonSerialize();
  132.         $this->addSql("INSERT INTO `app_media_content` (`academy_category_id`, `feature_tutorial_id`, `book_id`, `guid`, `position`, `title`, `description`, `is_enabled`, `is_required`, `url`, `type`, `link`, `text`, `duration`, `thumbnail`) VALUES (@category_id, NULL, NULL, '" $mediaGuid "', 5, '1.1 - ¡Bienvenido a la Digital Academy!', '', 1, 0, '', 'media_content_video', 'https://player.vimeo.com/video/1086212588', NULL, 194, 'https://i.vimeocdn.com/video/2017936484-da665916df4d2f97f31c47a84018224794f40e5b9fb53d23ab34c49ad3dddee2-d_640?region=us')");
  133.         // AR
  134.         $academyGuid Uuid::v6()->jsonSerialize();
  135.         $this->addSql("INSERT INTO `app_academy` (`feature_id`, `title`, `description`, `is_enabled`, `language`, `educator_id`, `guid`) VALUES (@feature_id, 'Digital Academy', '', 1, 'ar', (SELECT `id` from `app_user` WHERE `email` = 'mathieu.roccia@futures-infinity.com'), '" $academyGuid "')");
  136.         $this->addSql("SET @academy_id = LAST_INSERT_ID();");
  137.         $this->addSql("INSERT INTO `app_academy_chapter` (`academy_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@academy_id, NULL, '', 1, 1)");
  138.         $this->addSql("SET @chapter_id = LAST_INSERT_ID();");
  139.         $this->addSql("INSERT INTO `app_academy_sub_chapter` (`academy_chapter_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@chapter_id, 'الوحدة 1', 'مفاتيح النجاح المستدام', 1, 1)");
  140.         $this->addSql("SET @sub_chapter_id = LAST_INSERT_ID();");
  141.         $this->addSql("INSERT INTO `app_academy_category` (`academy_sub_chapter_id`, `title`, `description`, `position`, `is_enabled`) VALUES (@sub_chapter_id, 'الخطوات الأولى مع Digital Academy', '', 5, 1)");
  142.         $this->addSql("SET @category_id = LAST_INSERT_ID();");
  143.         $mediaGuid Uuid::v6()->jsonSerialize();
  144.         $this->addSql("INSERT INTO `app_media_content` (`academy_category_id`, `feature_tutorial_id`, `book_id`, `guid`, `position`, `title`, `description`, `is_enabled`, `is_required`, `url`, `type`, `link`, `text`, `duration`, `thumbnail`) VALUES (@category_id, NULL, NULL, '" $mediaGuid "', 5, '1.1 - مرحبًا بك في Digital Academy!', '', 1, 0, '', 'media_content_video', 'https://player.vimeo.com/video/1086212588', NULL, 194, 'https://i.vimeocdn.com/video/2017936484-da665916df4d2f97f31c47a84018224794f40e5b9fb53d23ab34c49ad3dddee2-d_640?region=us')");
  145.     }
  146.     public function down(Schema $schema): void
  147.     {
  148.         $this->addSql('DROP INDEX UNIQ_74108E862B6FCFB2 ON app_academy');
  149.         $this->addSql('ALTER TABLE app_academy DROP guid');
  150.         $this->addSql('ALTER TABLE app_media_content DROP duration');
  151.         $this->addSql('ALTER TABLE app_media_content DROP thumbnail');
  152.     }
  153. }