migrations/Version20250724084328.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. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20250724084328 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return 'Paiements en 3x - Gestion des points, commissions et index de paiement en 3x';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.         // this up() migration is auto-generated, please modify it to your needs
  18.         $this->addSql('ALTER TABLE app_product_point ADD points_month1 INT DEFAULT NULL, ADD points_month2 INT DEFAULT NULL, ADD points_month3 INT DEFAULT NULL');
  19.         $this->addSql('ALTER TABLE app_product_price ADD commission_month1 INT DEFAULT NULL AFTER subscription_commission, ADD commission_month2 INT DEFAULT NULL AFTER commission_month1, ADD commission_month3 INT DEFAULT NULL AFTER commission_month2');
  20.         $this->addSql('ALTER TABLE app_payment_history ADD is_installment TINYINT(1) NOT NULL DEFAULT 0, ADD index_installment INT DEFAULT NULL');
  21.         // Points
  22.         // Digital Europe
  23.         $this->addSql('UPDATE app_product_point SET points_month1 = 130, points_month2 = 98, points_month3 = 98 WHERE product_id IN (41) and market_id = 1;');
  24.         // Digital Asie/Afrique
  25.         $this->addSql('UPDATE app_product_point SET points_month1 = 66, points_month2 = 50, points_month3 = 50 WHERE product_id IN (41) and market_id IN (2, 3);');
  26.         // Ecom Europe
  27.         $this->addSql('UPDATE app_product_point SET points_month1 = 168, points_month2 = 126, points_month3 = 126 WHERE product_id IN (42) and market_id = 1;');
  28.         // Ecom Asie/Afrique
  29.         $this->addSql('UPDATE app_product_point SET points_month1 = 86, points_month2 = 64, points_month3 = 64 WHERE product_id IN (42) and market_id IN (2, 3);');
  30.         // Digital + Ecom Europe
  31.         $this->addSql('UPDATE app_product_point SET points_month1 = 128, points_month2 = 96, points_month3 = 96 WHERE product_id IN (44) and market_id = 1;');
  32.         // Digital + Ecom Asie/Afrique
  33.         $this->addSql('UPDATE app_product_point SET points_month1 = 64, points_month2 = 48, points_month3 = 48 WHERE product_id IN (44) and market_id IN (2, 3);');
  34.         // Premium 6 mois Europe
  35.         $this->addSql('UPDATE app_product_point SET points_month1 = 216, points_month2 = 162, points_month3 = 162 WHERE product_id IN (9) and nb_month = 6 and market_id = 1;');
  36.         // Premium 6 mois Asie/Afrique
  37.         $this->addSql('UPDATE app_product_point SET points_month1 = 120, points_month2 = 90, points_month3 = 90 WHERE product_id IN (9) and nb_month = 6 and market_id IN (2, 3);');
  38.         // Premium 12 mois Europe
  39.         $this->addSql('UPDATE app_product_point SET points_month1 = 360, points_month2 = 270, points_month3 = 270 WHERE product_id IN (9) and nb_month = 12 and market_id = 1;');
  40.         // Premium 12 mois Asie/Afrique
  41.         $this->addSql('UPDATE app_product_point SET points_month1 = 216, points_month2 = 162, points_month3 = 162 WHERE product_id IN (9) and nb_month = 12 and market_id IN (2, 3);');
  42.         // Full Gold / Silver 6 mois Europe
  43.         $this->addSql('UPDATE app_product_point SET points_month1 = 144, points_month2 = 108, points_month3 = 108 WHERE product_id IN (3, 7) and nb_month = 6 and market_id = 1;');
  44.         // Full Gold / Silver 6 mois Asie/Afrique
  45.         $this->addSql('UPDATE app_product_point SET points_month1 = 84, points_month2 = 63, points_month3 = 63 WHERE product_id IN (3, 7) and nb_month = 6 and market_id IN (2, 3);');
  46.         // Full Gold / Silver 12 mois Europe
  47.         $this->addSql('UPDATE app_product_point SET points_month1 = 240, points_month2 = 180, points_month3 = 180 WHERE product_id IN (3, 7) and nb_month = 12 and market_id = 1;');
  48.         // Full Gold / Silver 12 mois Asie/Afrique
  49.         $this->addSql('UPDATE app_product_point SET points_month1 = 130, points_month2 = 97, points_month3 = 97 WHERE product_id IN (3, 7) and nb_month = 12 and market_id IN (2, 3);');
  50.         // Commissions
  51.         // Digital Europe
  52.         $this->addSql('UPDATE app_product_price SET commission_month1 = 69, commission_month2 = 52, commission_month3 = 52 WHERE product_id IN (41) and market_id = 1;');
  53.         // Digital Asie/Afrique
  54.         $this->addSql('UPDATE app_product_price SET commission_month1 = 25, commission_month2 = 19, commission_month3 = 20 WHERE product_id IN (41) and market_id IN (2, 3);');
  55.         // Ecom Europe
  56.         $this->addSql('UPDATE app_product_price SET commission_month1 = 88, commission_month2 = 66, commission_month3 = 66 WHERE product_id IN (42) and market_id = 1;');
  57.         // Ecom Asie/Afrique
  58.         $this->addSql('UPDATE app_product_price SET commission_month1 = 44, commission_month2 = 33, commission_month3 = 33 WHERE product_id IN (42) and market_id IN (2, 3);');
  59.         // Digital + Ecom Europe
  60.         $this->addSql('UPDATE app_product_price SET commission_month1 = 67, commission_month2 = 50, commission_month3 = 50 WHERE product_id IN (44) and market_id = 1;');
  61.         // Digital + Ecom Asie/Afrique
  62.         $this->addSql('UPDATE app_product_price SET commission_month1 = 33, commission_month2 = 25, commission_month3 = 25 WHERE product_id IN (44) and market_id IN (2, 3);');
  63.         // Premium 6 mois Europe
  64.         $this->addSql('UPDATE app_product_price SET commission_month1 = 84, commission_month2 = 63, commission_month3 = 63 WHERE product_id IN (9) and nb_month = 6 and market_id = 1;');
  65.         // Premium 6 mois Asie/Afrique
  66.         $this->addSql('UPDATE app_product_price SET commission_month1 = 40, commission_month2 = 30, commission_month3 = 30 WHERE product_id IN (9) and nb_month = 6 and market_id IN (2, 3);');
  67.         // Premium 12 mois Europe
  68.         $this->addSql('UPDATE app_product_price SET commission_month1 = 160, commission_month2 = 120, commission_month3 = 120 WHERE product_id IN (9) and nb_month = 12 and market_id = 1;');
  69.         // Premium 12 mois Asie/Afrique
  70.         $this->addSql('UPDATE app_product_price SET commission_month1 = 58, commission_month2 = 43, commission_month3 = 44 WHERE product_id IN (9) and nb_month = 12 and market_id IN (2, 3);');
  71.         // Full Gold / Silver 6 mois Europe
  72.         $this->addSql('UPDATE app_product_price SET commission_month1 = 56, commission_month2 = 42, commission_month3 = 42 WHERE product_id IN (3, 7) and nb_month = 6 and market_id = 1;');
  73.         // Full Gold / Silver 6 mois Asie/Afrique
  74.         $this->addSql('UPDATE app_product_price SET commission_month1 = 16, commission_month2 = 12, commission_month3 = 12 WHERE product_id IN (3, 7) and nb_month = 6 and market_id IN (2, 3);');
  75.         // Full Gold / Silver 12 mois Europe
  76.         $this->addSql('UPDATE app_product_price SET commission_month1 = 104, commission_month2 = 78, commission_month3 = 78 WHERE product_id IN (3, 7) and nb_month = 12 and market_id = 1;');
  77.         // Full Gold / Silver 12 mois Asie/Afrique
  78.         $this->addSql('UPDATE app_product_price SET commission_month1 = 41, commission_month2 = 32, commission_month3 = 33 WHERE product_id IN (3, 7) and nb_month = 12 and market_id IN (2, 3);');
  79.     }
  80.     public function down(Schema $schema): void
  81.     {
  82.         // this down() migration is auto-generated, please modify it to your needs
  83.         $this->addSql('ALTER TABLE app_product_point DROP points_month1, DROP points_month2, DROP points_month3');
  84.         $this->addSql('ALTER TABLE app_product_price DROP commission_month1, DROP commission_month2, DROP commission_month3');
  85.         $this->addSql('ALTER TABLE app_payment_history DROP is_installment, DROP index_installment');
  86.     }
  87. }