Procházet zdrojové kódy

new migration for all changes, adjustments data import

master
Daniel před 7 měsíci
rodič
revize
3edc03bf54
10 změnil soubory, kde provedl 29 přidání a 263 odebrání
  1. +0
    -65
      httpdocs/migrations/Version20250428094124.php
  2. +0
    -41
      httpdocs/migrations/Version20250507154018.php
  3. +0
    -35
      httpdocs/migrations/Version20250605145642.php
  4. +0
    -31
      httpdocs/migrations/Version20250606081404.php
  5. +0
    -31
      httpdocs/migrations/Version20250730143720.php
  6. +0
    -31
      httpdocs/migrations/Version20250730143825.php
  7. +13
    -7
      httpdocs/migrations/Version20250731151555.php
  8. binární
      httpdocs/src/Command/Import/Import-Template.numbers
  9. binární
      httpdocs/src/Command/Import/Import-Template.xlsx
  10. +16
    -22
      httpdocs/src/Command/Import/ImportExcelCommand.php

+ 0
- 65
httpdocs/migrations/Version20250428094124.php Zobrazit soubor

@@ -1,65 +0,0 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250428094124 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
ALTER TABLE location ADD is_start_end TINYINT(1) NOT NULL
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE trip ADD completed TINYINT(1) NOT NULL, DROP captain_name
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE trip_location ADD is_transit TINYINT(1) NOT NULL, ADD is_departure TINYINT(1) NOT NULL
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE user ADD is_pilot TINYINT(1) NOT NULL
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE user_trip ADD approved TINYINT(1) NOT NULL
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE vessel ADD length DOUBLE PRECISION DEFAULT NULL, ADD breadth DOUBLE PRECISION DEFAULT NULL, ADD draft DOUBLE PRECISION DEFAULT NULL, ADD gross_tonnage DOUBLE PRECISION DEFAULT NULL, ADD imo_no VARCHAR(255) DEFAULT NULL, ADD call_sign VARCHAR(255) DEFAULT NULL
SQL);
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
ALTER TABLE location DROP is_start_end
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE `user` DROP is_pilot
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE vessel DROP length, DROP breadth, DROP draft, DROP gross_tonnage, DROP imo_no, DROP call_sign
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE trip_location DROP is_transit, DROP is_departure
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE trip ADD captain_name VARCHAR(255) DEFAULT NULL, DROP completed
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE user_trip DROP approved
SQL);
}
}

+ 0
- 41
httpdocs/migrations/Version20250507154018.php Zobrazit soubor

@@ -1,41 +0,0 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250507154018 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
ALTER TABLE trip DROP customer_reference
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE trip_location ADD arrival_date_time DATETIME DEFAULT NULL COMMENT '(DC2Type:datetime_immutable)', ADD departure_date_time DATETIME DEFAULT NULL COMMENT '(DC2Type:datetime_immutable)', DROP is_arrival, DROP date, DROP is_transit, DROP is_departure
SQL);
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql(<<<'SQL'
ALTER TABLE trip_location ADD is_arrival TINYINT(1) NOT NULL, ADD date DATETIME NOT NULL COMMENT '(DC2Type:datetime_immutable)', ADD is_transit TINYINT(1) NOT NULL, ADD is_departure TINYINT(1) NOT NULL, DROP arrival_date_time, DROP departure_date_time
SQL);
$this->addSql(<<<'SQL'
ALTER TABLE trip ADD customer_reference VARCHAR(255) DEFAULT NULL
SQL);
}
}

+ 0
- 35
httpdocs/migrations/Version20250605145642.php Zobrazit soubor

@@ -1,35 +0,0 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250605145642 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE user_zone (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, zone_id INT NOT NULL, INDEX IDX_DA6A8CCEA76ED395 (user_id), INDEX IDX_DA6A8CCE9F2C3FAB (zone_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE user_zone ADD CONSTRAINT FK_DA6A8CCEA76ED395 FOREIGN KEY (user_id) REFERENCES `user` (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE user_zone ADD CONSTRAINT FK_DA6A8CCE9F2C3FAB FOREIGN KEY (zone_id) REFERENCES zone (id) ON DELETE CASCADE');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE user_zone DROP FOREIGN KEY FK_DA6A8CCEA76ED395');
$this->addSql('ALTER TABLE user_zone DROP FOREIGN KEY FK_DA6A8CCE9F2C3FAB');
$this->addSql('DROP TABLE user_zone');
}
}

+ 0
- 31
httpdocs/migrations/Version20250606081404.php Zobrazit soubor

@@ -1,31 +0,0 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250606081404 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE UNIQUE INDEX unique_user_zone ON user_zone (zone_id, user_id)');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX unique_user_zone ON user_zone');
}
}

+ 0
- 31
httpdocs/migrations/Version20250730143720.php Zobrazit soubor

@@ -1,31 +0,0 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250730143720 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE trip ADD pilotage_reference VARCHAR(255) NOT NULL');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('ALTER TABLE trip DROP pilotage_reference');
}
}

+ 0
- 31
httpdocs/migrations/Version20250730143825.php Zobrazit soubor

@@ -1,31 +0,0 @@
<?php

declare(strict_types=1);

namespace DoctrineMigrations;

use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;

/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250730143825 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}

public function up(Schema $schema): void
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE UNIQUE INDEX UNIQ_7656F53B69AF50E7 ON trip (pilotage_reference)');
}

public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('DROP INDEX UNIQ_7656F53B69AF50E7 ON trip');
}
}

httpdocs/migrations/Version20250324103944.php → httpdocs/migrations/Version20250731151555.php Zobrazit soubor

@@ -10,7 +10,7 @@ use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250324103944 extends AbstractMigration
final class Version20250731151555 extends AbstractMigration
{
public function getDescription(): string
{
@@ -21,15 +21,16 @@ final class Version20250324103944 extends AbstractMigration
{
// this up() migration is auto-generated, please modify it to your needs
$this->addSql('CREATE TABLE event (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, identifier VARCHAR(255) NOT NULL, sequence INT UNSIGNED NOT NULL, mandatory TINYINT(1) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_3BAE0AA75E237E06 (name), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE location (id INT AUTO_INCREMENT NOT NULL, zone_id INT NOT NULL, code VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, is_zone TINYINT(1) NOT NULL, is_place TINYINT(1) NOT NULL, is_port TINYINT(1) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_5E9E89CB9F2C3FAB (zone_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE location (id INT AUTO_INCREMENT NOT NULL, zone_id INT NOT NULL, code VARCHAR(255) NOT NULL, name VARCHAR(255) NOT NULL, is_zone TINYINT(1) NOT NULL, is_place TINYINT(1) NOT NULL, is_port TINYINT(1) NOT NULL, is_start_end TINYINT(1) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_5E9E89CB9F2C3FAB (zone_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE media_object (id INT AUTO_INCREMENT NOT NULL, created_by_id INT NOT NULL, file_path VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_14D43132B03A8386 (created_by_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE shipping_company (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_A9F70F8B77153098 (code), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE trip (id INT AUTO_INCREMENT NOT NULL, vessel_id INT NOT NULL, start_location_id INT NOT NULL, end_location_id INT NOT NULL, customer_reference VARCHAR(255) DEFAULT NULL, captain_name VARCHAR(255) DEFAULT NULL, start_date DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', end_date DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', note LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_7656F53B14AF1953 (vessel_id), INDEX IDX_7656F53B5C3A313A (start_location_id), INDEX IDX_7656F53BC43C7F1 (end_location_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE trip_location (id INT AUTO_INCREMENT NOT NULL, trip_id INT NOT NULL, location_id INT NOT NULL, is_arrival TINYINT(1) NOT NULL, date DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_F6CFBADBA5BC2E0E (trip_id), INDEX IDX_F6CFBADB64D218E (location_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE `user` (id INT AUTO_INCREMENT NOT NULL, image_id INT DEFAULT NULL, email VARCHAR(180) NOT NULL, reference_id VARCHAR(255) NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, roles JSON NOT NULL COMMENT \'(DC2Type:json)\', password VARCHAR(255) NOT NULL, active TINYINT(1) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), INDEX IDX_8D93D6493DA5256D (image_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_trip (id INT AUTO_INCREMENT NOT NULL, trip_id INT NOT NULL, user_id INT NOT NULL, signature_id INT DEFAULT NULL, captain_name VARCHAR(255) DEFAULT NULL, completed TINYINT(1) NOT NULL, completed_date DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_CD7B9F2A5BC2E0E (trip_id), INDEX IDX_CD7B9F2A76ED395 (user_id), INDEX IDX_CD7B9F2ED61183A (signature_id), UNIQUE INDEX unique_user_trip (trip_id, user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE trip (id INT AUTO_INCREMENT NOT NULL, vessel_id INT NOT NULL, start_location_id INT NOT NULL, end_location_id INT NOT NULL, pilotage_reference VARCHAR(255) NOT NULL, start_date DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', end_date DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', note LONGTEXT DEFAULT NULL, completed TINYINT(1) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_7656F53B69AF50E7 (pilotage_reference), INDEX IDX_7656F53B14AF1953 (vessel_id), INDEX IDX_7656F53B5C3A313A (start_location_id), INDEX IDX_7656F53BC43C7F1 (end_location_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE trip_location (id INT AUTO_INCREMENT NOT NULL, trip_id INT NOT NULL, location_id INT NOT NULL, arrival_date_time DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', departure_date_time DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_F6CFBADBA5BC2E0E (trip_id), INDEX IDX_F6CFBADB64D218E (location_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE `user` (id INT AUTO_INCREMENT NOT NULL, image_id INT DEFAULT NULL, email VARCHAR(180) NOT NULL, reference_id VARCHAR(255) NOT NULL, first_name VARCHAR(255) NOT NULL, last_name VARCHAR(255) NOT NULL, is_pilot TINYINT(1) NOT NULL, roles JSON NOT NULL COMMENT \'(DC2Type:json)\', password VARCHAR(255) NOT NULL, active TINYINT(1) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_8D93D649E7927C74 (email), INDEX IDX_8D93D6493DA5256D (image_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_trip (id INT AUTO_INCREMENT NOT NULL, trip_id INT NOT NULL, user_id INT NOT NULL, signature_id INT DEFAULT NULL, captain_name VARCHAR(255) DEFAULT NULL, completed TINYINT(1) NOT NULL, approved TINYINT(1) NOT NULL, completed_date DATETIME DEFAULT NULL COMMENT \'(DC2Type:datetime_immutable)\', created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_CD7B9F2A5BC2E0E (trip_id), INDEX IDX_CD7B9F2A76ED395 (user_id), INDEX IDX_CD7B9F2ED61183A (signature_id), UNIQUE INDEX unique_user_trip (trip_id, user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_trip_event (id INT AUTO_INCREMENT NOT NULL, user_trip_id INT NOT NULL, event_id INT NOT NULL, location_id INT NOT NULL, date DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', note LONGTEXT DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', INDEX IDX_46824C08FDB13004 (user_trip_id), INDEX IDX_46824C0871F7E88B (event_id), INDEX IDX_46824C0864D218E (location_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE vessel (id INT AUTO_INCREMENT NOT NULL, company_id INT NOT NULL, name VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_4ED8DCA877153098 (code), INDEX IDX_4ED8DCA8979B1AD6 (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE user_zone (id INT AUTO_INCREMENT NOT NULL, user_id INT NOT NULL, zone_id INT NOT NULL, INDEX IDX_DA6A8CCEA76ED395 (user_id), INDEX IDX_DA6A8CCE9F2C3FAB (zone_id), UNIQUE INDEX unique_user_zone (zone_id, user_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE vessel (id INT AUTO_INCREMENT NOT NULL, company_id INT NOT NULL, name VARCHAR(255) NOT NULL, code VARCHAR(255) NOT NULL, length DOUBLE PRECISION DEFAULT NULL, breadth DOUBLE PRECISION DEFAULT NULL, draft DOUBLE PRECISION DEFAULT NULL, gross_tonnage DOUBLE PRECISION DEFAULT NULL, imo_no VARCHAR(255) DEFAULT NULL, call_sign VARCHAR(255) DEFAULT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', UNIQUE INDEX UNIQ_4ED8DCA877153098 (code), INDEX IDX_4ED8DCA8979B1AD6 (company_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('CREATE TABLE zone (id INT AUTO_INCREMENT NOT NULL, name VARCHAR(255) NOT NULL, created_at DATETIME NOT NULL COMMENT \'(DC2Type:datetime_immutable)\', PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8mb4 COLLATE `utf8mb4_unicode_ci` ENGINE = InnoDB');
$this->addSql('ALTER TABLE location ADD CONSTRAINT FK_5E9E89CB9F2C3FAB FOREIGN KEY (zone_id) REFERENCES zone (id)');
$this->addSql('ALTER TABLE media_object ADD CONSTRAINT FK_14D43132B03A8386 FOREIGN KEY (created_by_id) REFERENCES `user` (id) ON DELETE CASCADE');
@@ -45,6 +46,8 @@ final class Version20250324103944 extends AbstractMigration
$this->addSql('ALTER TABLE user_trip_event ADD CONSTRAINT FK_46824C08FDB13004 FOREIGN KEY (user_trip_id) REFERENCES user_trip (id)');
$this->addSql('ALTER TABLE user_trip_event ADD CONSTRAINT FK_46824C0871F7E88B FOREIGN KEY (event_id) REFERENCES event (id)');
$this->addSql('ALTER TABLE user_trip_event ADD CONSTRAINT FK_46824C0864D218E FOREIGN KEY (location_id) REFERENCES location (id)');
$this->addSql('ALTER TABLE user_zone ADD CONSTRAINT FK_DA6A8CCEA76ED395 FOREIGN KEY (user_id) REFERENCES `user` (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE user_zone ADD CONSTRAINT FK_DA6A8CCE9F2C3FAB FOREIGN KEY (zone_id) REFERENCES zone (id) ON DELETE CASCADE');
$this->addSql('ALTER TABLE vessel ADD CONSTRAINT FK_4ED8DCA8979B1AD6 FOREIGN KEY (company_id) REFERENCES shipping_company (id)');
}

@@ -65,6 +68,8 @@ final class Version20250324103944 extends AbstractMigration
$this->addSql('ALTER TABLE user_trip_event DROP FOREIGN KEY FK_46824C08FDB13004');
$this->addSql('ALTER TABLE user_trip_event DROP FOREIGN KEY FK_46824C0871F7E88B');
$this->addSql('ALTER TABLE user_trip_event DROP FOREIGN KEY FK_46824C0864D218E');
$this->addSql('ALTER TABLE user_zone DROP FOREIGN KEY FK_DA6A8CCEA76ED395');
$this->addSql('ALTER TABLE user_zone DROP FOREIGN KEY FK_DA6A8CCE9F2C3FAB');
$this->addSql('ALTER TABLE vessel DROP FOREIGN KEY FK_4ED8DCA8979B1AD6');
$this->addSql('DROP TABLE event');
$this->addSql('DROP TABLE location');
@@ -75,6 +80,7 @@ final class Version20250324103944 extends AbstractMigration
$this->addSql('DROP TABLE `user`');
$this->addSql('DROP TABLE user_trip');
$this->addSql('DROP TABLE user_trip_event');
$this->addSql('DROP TABLE user_zone');
$this->addSql('DROP TABLE vessel');
$this->addSql('DROP TABLE zone');
}

binární
httpdocs/src/Command/Import/Import-Template.numbers Zobrazit soubor


binární
httpdocs/src/Command/Import/Import-Template.xlsx Zobrazit soubor


+ 16
- 22
httpdocs/src/Command/Import/ImportExcelCommand.php Zobrazit soubor

@@ -101,16 +101,17 @@ class ImportExcelCommand extends Command
$count = 0;
foreach ($rows as $row) {
$data = array_combine($headers, $row);
if ($data['id'] !== null) {
// Prüfe, ob Zone bereits existiert
$existingZone = $this->entityManager->getRepository(Zone::class)
->findOneBy(['name' => $data['name']]);

// Prüfe, ob Zone bereits existiert
$existingZone = $this->entityManager->getRepository(Zone::class)
->findOneBy(['name' => $data['name']]);

if (!$existingZone) {
$zone = new Zone($data['name']);
if (!$existingZone) {
$zone = new Zone($data['name']);

$this->entityManager->persist($zone);
$count++;
$this->entityManager->persist($zone);
$count++;
}
}
}

@@ -338,20 +339,13 @@ class ImportExcelCommand extends Command
);
$endDateImmutable = DateTimeImmutable::createFromMutable($endDate);

// Prüfe, ob Trip bereits existiert (basierend auf Vessel und Datum)
$existingTrip = $this->entityManager->getRepository(Trip::class)
->findOneBy([
'vessel' => $vessel,
'startDate' => $startDateImmutable,
'startLocation' => $startLocation
]);

if (!$existingTrip) {
$trip = new Trip($vessel, $startLocation, $endLocation, $startDateImmutable, $endDateImmutable);
$trip->setCompleted();
$this->entityManager->persist($trip);
$count++;
}
$pilotageReference = $data['pilotage_reference'];

$trip = new Trip($vessel, $startLocation, $endLocation, $startDateImmutable, $endDateImmutable);
$trip->setPilotageReference($pilotageReference);
$trip->setCompleted();
$this->entityManager->persist($trip);
$count++;
}

$io->success("Imported $count trips");


Načítá se…
Zrušit
Uložit