εχει κανει ποτε κανείς migrate/upgrade απο 7 σε 8/...
# chat
b
εχει κανει ποτε κανείς migrate/upgrade απο 7 σε 8/9/10 ?? τα custom fields (που όμως είναι core field types) γίνονται migrate καπως? Μου φτιάχνει content types, φέρνει το body μια χαρά, αλλά τα υπόλοιπα fields (terms references, integers) ουτε τα φτιάχνει ούτε και τα φέρνει προφανώς. Είναι αναμενόμενο αυτό;
v
Είχα κάνει πριν πολύ καιρό. Θυμάμαι ότι μπορεσα να κάνω τα πάντα με preprocesing του row. Αλλά δεν θυμάμαι λεπτομέρειες.
v
Ola ta fields mporoun na ginoun migrate, alla prepei to destination sto yaml tous na na einai to antistoixo plugin gia to entity pou aniki to field. Diladi an exeis ena node custom field or core field tote sto yml to destination plugin prepi na einai entity:node, to idio kai vocabulary/term entity:taxonomy_term kai meta sto class kaneis query ta table values (created, uid etc.) pou thelis na ginoun migrate apo to palio site kai sto prepare row kaneis tin logiki ama einai complex i apla kaneis set to row apo to query sou sto neo table.
b
Πρέπει όμως να τα φτιαξω εγώ τα fields? Μου κάνει εντύπωση που δε τα κάνει μόνο του. Μιλάμε μόνο για types που είναι στο D10 core (integers, term reference κτλ)
v
Den tha ta ftiaksis esi, alla prepi na peraseis to destination sto yaml tous, eidika gia term reference. Episis prepi na dosis sto process ta field opos einai perasmena sto 10 px an einai custom dinis to machine name tou field field_custom: {edo orizisis oti name thes} kai auto to name tha einai sto prepare row san alias tou field. Auti edo i methodos einai poli simantiki na exei ena id apo to table pou tha kanis migrate, leitourgei san anagnoristiko gia kathe row pano kato
Copy code
public function getIds(): array {
  return [
    'nid' => [
      'type' => 'integer',
      'alias' => 'n',
    ],
  ];
}
px
Copy code
id: file_managed
label: File managed
migration_tags:
  - File
source:
  plugin: file_managed
destination:
  plugin: entity:file
process:
  fid: fid
  filename: filename
  uri: uri
Auto einai gia files opote to destination paei se entity:file. Meta sto class kanis query ta palia fields pou thes na peraseis apo to palio site kai sto prepare row gia kathe field pou exeis perasei sto query exeis tin timi sto row
$nid = $row->getSourceProperty('nid');
Meta apla kaneis ena
$row->setSourceProperty('nid', $nid);
px otan thes na peraseis to value.
Episis oso anafora ta core den exei simasia to type apo tin stigmi pou exeis kanei field diko sou einai custom.