Migrate timeslot.

@param $oldTimeslot
764329
protected function migrateTimeslot($oldTimeslot)
    {
        $timeslot = ScoolTimeSlot::firstOrNew([
            'init'    => $oldTimeslot->start_time,
            'end'     => $oldTimeslot->end_time,
            'lective' => $oldTimeslot->lective,

            'order'   => $oldTimeslot->order,
        ]);
        if ( $oldTimeslot->order < 8 ) {
            $timeslot->addShiftOnlyIfNotExists(Shift::where('name', 'Matí')->first());
        }
        if ( $oldTimeslot->order > 8 )
        {
            $timeslot->addShiftOnlyIfNotExists(Shift::where('name','Tarda')->first());
        }

        $timeslot->save();
    }
649614
private function migrateDateData()
    {
        if (!$this->connection->getSchemaManager()->listTableDetails('ujm_exercise')->hasColumn('start_date')) {
            return; // migration has already been executed
        }

        $this->log('Moving date data from ujm_exercise to claro_resource_node...');

        $startQuery = '
            UPDATE claro_resource_node AS node
            JOIN ujm_exercise AS exo
            ON node.id = exo.resourceNode_id
            SET node.accessible_from = exo.start_date
            WHERE node.accessible_from IS NULL
            AND exo.start_date IS NOT NULL
        ';
        $endQuery = '
            UPDATE claro_resource_node AS node
            JOIN ujm_exercise AS exo
            ON node.id = exo.resourceNode_id
            SET node.accessible_until = exo.end_date
            WHERE node.accessible_until IS NULL
            AND exo.start_date IS NOT NULL
            AND exo.use_date_end = 1
        ';

        $this->connection->exec($startQuery);
        $this->connection->exec($endQuery);
    }
1151738
public function migrateUp()
    {
        $this->builder->create(
            $this->table,
            function ($table) {
                $table->bigIncrements('id');

                $table->string('uuid')->unique()->index();
                $table->bigInteger('user_id')->unsigned()->nullable()->index();
                $table->bigInteger('device_id')->unsigned()->nullable()->index();
                $table->bigInteger('agent_id')->unsigned()->nullable()->index();
                $table->string('client_ip')->index();
                $table->bigInteger('referer_id')->unsigned()->nullable()->index();
                $table->bigInteger('cookie_id')->unsigned()->nullable()->index();
                $table->bigInteger('geoip_id')->unsigned()->nullable()->index();
                $table->boolean('is_robot');

                $table->timestamps();
                $table->index('created_at');
                $table->index('updated_at');
            }
        );
    }
1335057
public function migrateUp()
    {
        $this->builder->create(
            $this->table,
            function ($table) {
                $table->bigIncrements('id');

                $table->string('sha1', 40)->index();
                $table->text('statement');
                $table->double('time')->index();
                $table->integer('connection_id')->unsigned();

                $table->timestamps();
                $table->index('created_at');
                $table->index('updated_at');
            }
        );
    }
1134116
public function convertMongoTimestamp()
    {
        $this->createdAt = ($this->createdAt instanceof \MongoTimestamp) ? $this->createdAt->sec : $this->createdAt;
        $this->updatedAt = ($this->updatedAt instanceof \MongoTimestamp) ? $this->updatedAt->sec : $this->updatedAt;
    }
60881
public function migrateDown()
    {
        Schema::table('tddd_testers', function (Blueprint $table) {
            $table->boolean('require_tee');

            $table->boolean('require_script');

            $table->dropColumn('pipers');
        });
    }
877540
public function migrate()
	{
		$this->msg( sprintf( 'Add new type columns for Laravel' ), 0 );
		$this->status( '' );

		foreach( $this->tables as $rname => $list ) {
			$this->addColumn( $rname, $list );
		}

		$this->msg( sprintf( 'Drop old unique indexes for Laravel' ), 0 );
		$this->status( '' );

		foreach( $this->constraints as $rname => $list ) {
			$this->dropIndex( $rname, $list );
		}

		$this->msg( sprintf( 'Migrate typeid to type for Laravel' ), 0 );
		$this->status( '' );

		foreach( $this->migrations as $rname => $list ) {
			$this->migrateData( $rname, $list );
		}
	}
336022
public function migrateUp()
    {
        $this->builder->create(
            $this->table,
            function ($table) {
                $table->bigIncrements('id');

                $table->bigInteger('domain_id')->unsigned()->index();
                $table->string('url')->index();
                $table->string('host');

                $table->timestamps();
                $table->index('created_at');
                $table->index('updated_at');
            }
        );
    }
1358445
private function copyNodeStats(Node $oldNode, Node $newNode)
    {
        $oldNodeJobCount = $oldNode->getTotalJobCount();
        $newNode->addJobCount($oldNodeJobCount);
    }
337439
function setTimeStamp( $timestamp )
    {
        $date = getdate( $timestamp );
        $this->Time = $date[ 'hours' ] * self::SECONDS_AN_HOUR +
                      $date[ 'minutes' ] * self::SECONDS_A_MINUTE +
                      $date[ 'seconds' ];
    }
1033718
public static function convertDate($oldDateString, $newDateFormatString, $timezone = null) {
		$Date = new CakeTime($oldDateString, $timezone);
		return $Date->format($newDateFormatString);
	}
851056
public function moveToServer(string $host, $port = 6379, int $db = 0, int $timeout = 0, bool $replace = true): bool
    {
        return $this->handle->migrate($host, $port, $this->name, $db, $timeout, false, $replace);
    }
901877
private function cleanupTimestamp($timestamp): void
    {
        $key = sprintf('%s:%s', self::AT_QUEUE_NAME, $timestamp);

        if ($this->client->llen($key)) {
            $this->client->del([$key]);
            $this->client->zrem(self::AT_QUEUE_NAME, $timestamp);
        }
    }
1092996
public function migrateUp()
    {
        try {
            $this->builder->table(
                $this->table,
                function ($table) {
                    $table->dropUnique('tracker_agents_name_unique');

                    $table->string('name_hash', 65)->nullable();
                }
            );

            Agent::all()->each(function ($agent) {
                $agent->name_hash = hash('sha256', $agent->name);

                $agent->save();
            });

            $this->builder->table(
                $this->table,
                function ($table) {
                    $table->unique('name_hash');
                }
            );
        } catch (\Exception $e) {
            dd($e->getMessage());
        }
    }
798619
public function migrateDown()
    {
        try {
            $this->builder->table(
                $this->table,
                function ($table) {
                    $table->dropUnique('tracker_agents_name_hash_unique');

                    $table->dropColumn('name_hash');

                    $table->mediumText('name')->unique()->change();
                }
            );
        } catch (\Exception $e) {
        }
    }
500474
public function migrateUp()
    {
        Schema::table('tddd_runs', function (Blueprint $table) {
            $table->mediumText('log_new')->nullable()->after('was_ok');
        });

        Database::statement('update tddd_runs set log_new = log;');

        Schema::table('tddd_runs', function (Blueprint $table) {
            $table->dropColumn('log');
            $table->renameColumn('log_new', 'log');
        });
    }
341032
public static function fromTimestamp($timestamp)
    {
        try {
            $dateTime = new DateTime("@{$timestamp}");

            return static::fromDateTime($dateTime);
        } catch (Exception $e) {
            throw new InvalidArgumentValue('$timestamp', $timestamp, __CLASS__, $e);
        }
    }