# Migration von Punkten

### Import von Punkten zu Shopware 6

Es ist möglich die Punkte von anderen Systemen nach Shopware6 zu übernehmen. Hierfür muss die Datenbanktabelle **prems\_bonus\_system\_import\_point** mit Einträgen aus dem Fremdsystem befüllt werden.

Pflichtfelder für den Import sind:

* id (binary(16))
* customer\_number (int)
* points (int)
* reason (text, optional)
* created\_at (datetime(3))

Optional kann das Feld "reason" mit einem maximal 255 Zeichen langen Text gefüllt werden. Dieser Text tauscht später bei den Kunden als Grund für die Buchung auf. Der Texte könnte beispielsweise "Migration" oder "Punkteübernahme Altsystem" lauten.

Nachdem die Tabelle befüllt wurde, muss auf der Konsole der folgende Befehl ausgeführt werden:

`./console prems:bonus-system:import-points-from-db-table`

Ggf. ist es notwendig den Befehl mehrfach zu wiederholen, bis keine Einträge in der Tabelle **prems\_bonus\_system\_import\_point** mehr vorhanden sind.

### Migration von Punkten am Beispiel von Shopware 5

Punkte aus altem Shopsystem auslesen:

```
SELECT 
    UUID() AS id, 
    u.customernumber AS customer_number, 
    up.points AS points, 
    "Migration" AS reason 
FROM s_core_plugins_bonus_user_points AS up 
LEFT JOIN s_user AS u 
ON up.userID = u.id;
```

Die Punkte exportieren (ggf. als CSV) und nach UTF 8 kodieren.

In Shopware 6 Datenbank die CSV Datei in Datenbanktabelle *prems\_bonus\_system\_import\_point* einlesen.

Anschließend auf der Konsole den Befehl ausführen:

`./console prems:bonus-system:import-points-from-db-table`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.premsoft.de/plugins/bonus-system/migration-von-punkten.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
