Subversion-Projekte lars-tiefland.laravel_shop

Revision

Revision 620 | Revision 789 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 620 Revision 788
Zeile 174... Zeile 174...
174
                WHERE
174
                WHERE
175
                    id>" . $start . "
175
                    id>" . $start . "
176
            ";
176
            ";
177
            $methods = DB::connection( 'old' )->select( $sql );
177
            $methods = DB::connection( 'old' )->select( $sql );
178
            foreach ( $methods as $method )
178
            foreach ( $methods as $method )
179
	    {
179
            {
180
		$short = '';
180
                $short = '';
181
                if ( isset( $method->short ) && $method->short )
181
                if ( isset( $method->short ) && $method->short )
182
                {
182
                {
183
                    $short = $method->short;
183
                    $short = $method->short;
184
                }
184
                }
Zeile 384... Zeile 384...
384
                WHERE
384
                WHERE
385
                    id>' . $start . '
385
                    id>' . $start . '
386
            ';
386
            ';
387
            $dirs = DB::connection( 'old' )->select( $sql );
387
            $dirs = DB::connection( 'old' )->select( $sql );
388
            $progressbar = $this->output->createProgressBar( count( $dirs ) );
388
            $progressbar = $this->output->createProgressBar( count( $dirs ) );
389
	    $progressbar->start();
389
            $progressbar->start();
390
	    DB::statement('SET FOREIGN_KEY_CHECKS=0');
390
            DB::statement( 'SET FOREIGN_KEY_CHECKS=0' );
391
            foreach ( $dirs as $row )
391
            foreach ( $dirs as $row )
392
            {
392
            {
393
                $ersteller = $row->erstellt_von;
393
                $ersteller = $row->erstellt_von;
394
                if ( !$ersteller )
394
                if ( !$ersteller )
395
                {
395
                {
Zeile 416... Zeile 416...
416
                $dir->updated_at = $row->letzte_Aenderung_am;
416
                $dir->updated_at = $row->letzte_Aenderung_am;
417
                $dir->save();
417
                $dir->save();
418
                $progressbar->advance();
418
                $progressbar->advance();
419
            }
419
            }
420
            $progressbar->finish();
420
            $progressbar->finish();
421
	    $progressbar->clear();
421
            $progressbar->clear();
422
	    DB::statement('SET FOREIGN_KEY_CHECKS=1');
422
            DB::statement( 'SET FOREIGN_KEY_CHECKS=1' );
423
        }
423
        }
Zeile 424... Zeile 424...
424
 
424
 
425
        private function migrateItems()
425
        private function migrateItems()
426
        {
426
        {
427
            $this->info( date( "d.m.Y H:i:s" ) . ": Migriere Artikel" );
-
 
428
            $start = 0;
-
 
429
            $sql = "SELECT
-
 
430
                    MAX(id) AS start
-
 
431
                FROM
-
 
432
                    items
-
 
433
            ";
-
 
434
            $row = DB::connection( "mysql" )->select( $sql );
-
 
435
            if ( $row[0]->start )
-
 
436
            {
-
 
437
                $start = $row[0]->start;
-
 
438
            }
427
            $this->info( date( "d.m.Y H:i:s" ) . ": Migriere Artikel" );
439
            $sql = '
428
            $sql = '
440
                SELECT 
429
                SELECT 
441
                    *
430
                    *
442
                FROM
431
                FROM
443
                    artikel
-
 
444
                WHERE
-
 
445
                    father >= -1
-
 
446
                AND
-
 
447
                    id>' . $start . '
432
                    artikel
448
            ';
433
            ';
449
            $dirs = DB::connection( 'old' )->select( $sql );
434
            $items = DB::connection( 'old' )->select( $sql );
450
            $progressbar = $this->output->createProgressBar( count( $dirs ) );
435
            $progressbar = $this->output->createProgressBar( count( $items ) );
451
            $progressbar->start();
436
            $progressbar->start();
452
            foreach ( $dirs as $row )
437
            foreach ( $items as $row )
-
 
438
            {
-
 
439
                $item = Item::find( $row->ID );
-
 
440
                if($item->ID)
-
 
441
                {
453
            {
442
                    $progressbar->advance();
-
 
443
                    continue;
454
                $item = new Item();
444
                }
455
                $item->id = $row->ID;
445
                $item->id = $row->ID;
456
                $item->directory_id = $row->Father;
446
                $item->directory_id = $row->Father;
457
                $item->manufacturer_id = $row->hersteller;
447
                $item->manufacturer_id = $row->hersteller;
458
                $item->name = $row->kurzbezeichnung;
448
                $item->name = $row->kurzbezeichnung;
Zeile 1399... Zeile 1389...
1399
            $progressbar = $this->output->createProgressBar( count( $templates ) );
1389
            $progressbar = $this->output->createProgressBar( count( $templates ) );
1400
            $progressbar->start();
1390
            $progressbar->start();
1401
            foreach ( $templates as $template )
1391
            foreach ( $templates as $template )
1402
            {
1392
            {
1403
                ItemTemplate::factory()->create( [
1393
                ItemTemplate::factory()->create( [
1404
                    "id"           => $template->id,
1394
                    "id"          => $template->id,
1405
                    "item_id"      => $template->artikel_ID,
1395
                    "item_id"     => $template->artikel_ID,
1406
                    "template_id"  => $template->templates_ID,
1396
                    "template_id" => $template->templates_ID,
1407
                ] );
1397
                ] );
1408
                $progressbar->advance();
1398
                $progressbar->advance();
1409
            }
1399
            }
1410
            $progressbar->finish();
1400
            $progressbar->finish();
1411
            $progressbar->clear();
1401
            $progressbar->clear();