public function getDelta(Resource $resourceA, Resource $resourceB, MigrationInput $input)
    {
        $fieldChanges = $this->getFieldsDelta($resourceA->fields, $resourceB->fields);
        $indexChanges = $this->getIndexesDelta($resourceA->indexes, $resourceB->indexes);

        $changeCapsule = new MigrationChangeCapsule($fieldChanges, $indexChanges);

        $tracker = new MigrationHistoryTracker();
        $capsule = $tracker->get($input->tableName);

        if ($input->withoutTimestamps && $capsule->migrationHasTimestamps()) {
            $changeCapsule->dropTimestamps = true;
        } else if (!$input->withoutTimestamps && !$capsule->migrationHasTimestamps()) {
            $changeCapsule->addTimestamps = true;
        }

        if (!$input->withSoftDelete && $capsule->migrationHasSoftDelete()) {
            $changeCapsule->dropSoftDelete = true;
        } else if ($input->withSoftDelete && !$capsule->migrationHasSoftDelete()) {
            $changeCapsule->addSoftDelete = true;
        }

        return $changeCapsule;
    }
public function getDelta(Resource $resourceA, Resource $resourceB, MigrationInput $input)
    {
        $fieldChanges = $this->getFieldsDelta($resourceA->fields, $resourceB->fields);
        $indexChanges = $this->getIndexesDelta($resourceA->indexes, $resourceB->indexes);

        $changeCapsule = new MigrationChangeCapsule($fieldChanges, $indexChanges);

        $tracker = new MigrationHistoryTracker();
        $capsule = $tracker->get($input->tableName);

        if ($input->withoutTimestamps && $capsule->migrationHasTimestamps()) {
            $changeCapsule->dropTimestamps = true;
        } else if (!$input->withoutTimestamps && !$capsule->migrationHasTimestamps()) {
            $changeCapsule->addTimestamps = true;
        }

        if (!$input->withSoftDelete && $capsule->migrationHasSoftDelete()) {
            $changeCapsule->dropSoftDelete = true;
        } else if ($input->withSoftDelete && !$capsule->migrationHasSoftDelete()) {
            $changeCapsule->addSoftDelete = true;
        }

        return $changeCapsule;
    }
public function getDelta ( Resource $ resourceA , Resource $ resourceB , MigrationInput $ input ) { $ fieldChanges = $ this -> getFieldsDelta ( $ resourceA -> fields , $ resourceB -> fields ) ; $ indexChanges = $ this -> getIndexesDelta ( $ resourceA -> indexes , $ resourceB -> indexes ) ; $ changeCapsule = new MigrationChangeCapsule ( $ fieldChanges , $ indexChanges ) ; $ tracker = new MigrationHistoryTracker ( ) ; $ capsule = $ tracker -> get ( $ input -> tableName ) ; if ( $ input -> withoutTimestamps && $ capsule -> migrationHasTimestamps ( ) ) { $ changeCapsule -> dropTimestamps = true ; } else if ( ! $ input -> withoutTimestamps && ! $ capsule -> migrationHasTimestamps ( ) ) { $ changeCapsule -> addTimestamps = true ; } if ( ! $ input -> withSoftDelete && $ capsule -> migrationHasSoftDelete ( ) ) { $ changeCapsule -> dropSoftDelete = true ; } else if ( $ input -> withSoftDelete && ! $ capsule -> migrationHasSoftDelete ( ) ) { $ changeCapsule -> addSoftDelete = true ; } return $ changeCapsule ; }
Get the difference between a givin resource and the
resource in the current migration

@param CrestApps\CodeGenerator\Models\Resource $resourceA
@param CrestApps\CodeGenerator\Models\Resource $resourceB
@param CrestApps\CodeGenerator\Models\MigrationInput $input

@return CrestApps\CodeGenerator\Models\MigrationChangeCapsule
Get the difference between a givin resource and the resource in the current migration