[Removed] migrations
not working anyway; making module more light-weight
This commit is contained in:
parent
0a38b8a5d6
commit
d3f1f74e89
@ -1,38 +0,0 @@
|
|||||||
# Arbeiten mit [Doctrine Migrations](https://www.doctrine-project.org/projects/doctrine-migrations/en/3.6/reference/introduction.html)
|
|
||||||
|
|
||||||
Migrations bilden die Veränderung der Datenbankstruktur in programmierter Form ab. Jede Strukturänderung wird in einer einzelnen (jeweils neuen) Migrationsdatei abgelegt, die Teil des Moduls ist.
|
|
||||||
|
|
||||||
Passe die `migrations.yml` an Dein Modul an.
|
|
||||||
|
|
||||||
## Erstellen eines Skeletons für die erste oder zusätzliche Migrationen
|
|
||||||
|
|
||||||
```
|
|
||||||
./vendor/bin/oe-eshop-doctrine_migration migrations:generate d3moduleid
|
|
||||||
```
|
|
||||||
|
|
||||||
Arbeite die angelegte Datei entsprechend Deinen Anforderungen um.
|
|
||||||
|
|
||||||
## Ausführen der noch nicht ausgeführten Migrations
|
|
||||||
|
|
||||||
Doctrine überwacht selbst, welche Migrationen schon ausgeführt wurden und verhindert damit mehrfache Ausführungen der selben Migration.
|
|
||||||
|
|
||||||
Im OXID-Shop werden Migrations mit folgendem Befehl ausgeführt:
|
|
||||||
|
|
||||||
```
|
|
||||||
./vendor/bin/oe-eshop-db_migrate migrations:migrate
|
|
||||||
```
|
|
||||||
|
|
||||||
Als Argument kann noch die Suite mitgegeben werden, wenn nur bestimmte Migrations ausgeführt werden sollen. Mögliche Angaben sind:
|
|
||||||
|
|
||||||
- CE - für alle CE-Migrations
|
|
||||||
- PE - für alle PE-Migrations
|
|
||||||
- EE - für alle EE-Migrations
|
|
||||||
- PR - für alle Projekt-Migrations
|
|
||||||
- ModuleId - für alle Migrations des jeweiligen Moduls
|
|
||||||
- ohne Angabe - werden die Migrations aller Suiten nacheinander ausgeführt
|
|
||||||
|
|
||||||
## Abweichungen zwischen Doctrine Migrations und dem OXID Migration Wrapper
|
|
||||||
|
|
||||||
In den originalen Doctrine Migrations können keine Suiten angegeben werden. Dafür gibt es die Möglichkeit, die Richtung (up / down) und eine Zielversion anzugeben.
|
|
||||||
|
|
||||||
Bei OXID können Migrations ausschließlich aufwärts (up) und immer fix bis zur aktuellsten Version ausgeführt werden.
|
|
@ -1,54 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace D3\ManufacturerInformation\Migrations;
|
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
|
||||||
use Doctrine\DBAL\Types\DateTimeType;
|
|
||||||
use Doctrine\DBAL\Types\DateType;
|
|
||||||
use Doctrine\DBAL\Types\IntegerType;
|
|
||||||
use Doctrine\DBAL\Types\StringType;
|
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auto-generated Migration: Please modify to your needs!
|
|
||||||
*/
|
|
||||||
final class Version20241023154223 extends AbstractMigration
|
|
||||||
{
|
|
||||||
public function getDescription() : string
|
|
||||||
{
|
|
||||||
return 'Adds the D3 manufacturer longdesc column';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function up(Schema $schema) : void
|
|
||||||
{
|
|
||||||
$this->connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
|
|
||||||
|
|
||||||
$this->d3AddLongdescColumnToOxmanufacturers($schema);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down(Schema $schema) : void
|
|
||||||
{
|
|
||||||
// this down() migration is auto-generated, please modify it to your needs
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Schema $schema
|
|
||||||
* @return void
|
|
||||||
* @throws \Doctrine\DBAL\Schema\SchemaException
|
|
||||||
*/
|
|
||||||
public function d3AddLongdescColumnToOxmanufacturers(Schema $schema){
|
|
||||||
$table = !$schema->hasTable('oxmanufacturers') ?
|
|
||||||
$schema->createTable('oxmanufacturers') :
|
|
||||||
$schema->getTable('oxmanufacturers');
|
|
||||||
|
|
||||||
// Beschreibung
|
|
||||||
if (!$table->hasColumn('D3DESCRIPTION')) {
|
|
||||||
$table->addColumn('D3DESCRIPTION', (new StringType())->getName())
|
|
||||||
->setLength(255)
|
|
||||||
->setNotnull(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,65 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace D3\ManufacturerInformation\Migrations;
|
|
||||||
|
|
||||||
use Doctrine\DBAL\Schema\Schema;
|
|
||||||
use Doctrine\DBAL\Types\StringType;
|
|
||||||
use Doctrine\Migrations\AbstractMigration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Auto-generated Migration: Please modify to your needs!
|
|
||||||
*/
|
|
||||||
final class Version20241028172608 extends AbstractMigration
|
|
||||||
{
|
|
||||||
public function getDescription() : string
|
|
||||||
{
|
|
||||||
return 'Adds multilang tables';
|
|
||||||
}
|
|
||||||
|
|
||||||
public function up(Schema $schema) : void
|
|
||||||
{
|
|
||||||
$this->connection->getDatabasePlatform()->registerDoctrineTypeMapping('enum', 'string');
|
|
||||||
|
|
||||||
$this->d3AddLongdescMultilangColumnsToOxmanufacturers($schema);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function down(Schema $schema) : void
|
|
||||||
{
|
|
||||||
// this down() migration is auto-generated, please modify it to your needs
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Schema $schema
|
|
||||||
* @return void
|
|
||||||
* @throws \Doctrine\DBAL\Schema\SchemaException
|
|
||||||
*/
|
|
||||||
public function d3AddLongdescMultilangColumnsToOxmanufacturers(Schema $schema){
|
|
||||||
$table = !$schema->hasTable('oxmanufacturers') ?
|
|
||||||
$schema->createTable('oxmanufacturers') :
|
|
||||||
$schema->getTable('oxmanufacturers');
|
|
||||||
|
|
||||||
// lang 1
|
|
||||||
if (!$table->hasColumn('D3DESCRIPTION_1')) {
|
|
||||||
$table->addColumn('D3DESCRIPTION_1', (new StringType())->getName())
|
|
||||||
->setLength(255)
|
|
||||||
->setNotnull(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// lang 2
|
|
||||||
if (!$table->hasColumn('D3DESCRIPTION_2')) {
|
|
||||||
$table->addColumn('D3DESCRIPTION_2', (new StringType())->getName())
|
|
||||||
->setLength(255)
|
|
||||||
->setNotnull(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// lang 3
|
|
||||||
if (!$table->hasColumn('D3DESCRIPTION_3')) {
|
|
||||||
$table->addColumn('D3DESCRIPTION_3', (new StringType())->getName())
|
|
||||||
->setLength(255)
|
|
||||||
->setNotnull(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
name: D3 manufacturerinformation
|
|
||||||
migrations_namespace: D3\ManufacturerInformation\Migrations
|
|
||||||
table_name: d3migrations_manufacturerinformation
|
|
||||||
migrations_directory: data
|
|
Loading…
x
Reference in New Issue
Block a user