Restore metable table records for this current model since it was just restorede.

@return void
5218
private function handleRestoredModelMetas()
	{
		if (!$this->metableTableSoftDeletes()) {
			return;
		}
		
		foreach ($this->metas as $meta) {
			$this->syncMetableTableAttributes();
			$meta->increment('num_items');
		}
	}
533167
private function reset()
    {
        $this->table = null;
        $this->tables = null;
        $this->columns = '*';
        //
        $this->values =
        $this->sets = [];
        //
        $this->where =
        $this->order =
        $this->group = '';
    }
103562
public static function deleteArchiveTables()
    {
        foreach (ArchiveTableCreator::getTablesArchivesInstalled() as $table) {
            Log::debug("Dropping table $table");

            Db::query("DROP TABLE IF EXISTS `$table`");
        }

        ArchiveTableCreator::refreshTableList($forceReload = true);
    }
178777
public function restoreDB($dumpName = 'test')
    {
        $this->setDumpName($dumpName);
        $tables = $this->getDbTables();

        $dumpChecksum = $this->getDumpChecksum();
        $dumpTables = array_keys($dumpChecksum);

        foreach ($tables as $table) {
            if (!in_array($table, $dumpTables)) {
                $this->dropTable($table);
            } else {
                $this->restoreTable($table);
            }
        }

        $missingTables = array_diff($dumpTables, $tables);
        foreach ($missingTables as $table) {
            $this->restoreTable($table);
        }
        $this->setDumpName('test');
    }
978932
public function unsetDone() {
        $migration = $this->getMigration();
        if (!$migration['state']) {
            return true; //alredy undone
        }
        $this->db()->update($this->table, array('state' => false), array('id' => $migration['id']));
    }
719537
public function restoreDb()
    {
        $database = new Database($this->connection);

        try {
            $this->log('debug', sprintf('Restore database with file : %s', $this->backupFile));

            if (!file_exists($this->backupFile)) {
                return false;
            }

            $database->restoreDb($this->backupFile);
        } catch (\Exception $ex) {
            $this->log('error', sprintf('error during restore process with message : %s', $ex->getMessage()));
            print $ex->getMessage();
            return false;
        }

        return true;
    }
1284936
public function postSave()
    {
        // Check for revised fields
        $changes_to_record = $this->changedRevisionableFields();
        
        $revisions = array();
        
        // Loop through all attributes and create a new revision record each
        foreach (array_keys($changes_to_record) as $key) {
            $revisions[] = array(
                'revisionable_type' => get_class($this),
                'revisionable_id' => $this->getKey(),
                'attribute' => $key,
                'old_value' => array_get($this->originalData, $key),
                'new_value' => $this->updatedData[$key],
                'user_id' => $this->getUserId(),
                'created_at' => new \DateTime(),
                'updated_at' => new \DateTime(),
            );
        }
        
        if (count($revisions) > 0) {
            $revision = new Revision;
            \DB::table($revision->getTable())->insert($revisions);
        }
    }
773792
public static function reset()
    {
        // @todo Decouple these
        DBEnum::flushCache();
        ClassInfo::reset_db_cache();
        static::getSchema()->reset();
        self::$_cache_get_one = array();
        self::$_cache_field_labels = array();
    }
430203
protected function restoreFieldsForCount()
	{
		foreach (['orders', 'limit', 'offset', 'columns'] as $field)
		{
			$this->{$field} = $this->backups[$field];
		}

		$this->backups = [];
	}
521101
public function reloadFixtures()
    {
        if ( ! $this->useBackup) {
            $this->loadFixtures();

            return;
        }

        if ($this->hasBackup()) {
            $this->restoreBackup();

            $this->getReferenceRepository()
                 ->load($this->getBackupFile());

            return;
        }

        if ($this->migrations === null) {
            $this->dropDatabase();
            $this->createDatabase();
        }

        $this->loadFixtures();
        $this->createBackup();

        $this->getReferenceRepository()
             ->save($this->getBackupFile());
    }
338935
public function restoreSorting(array $scope = []): void
    {
        $records = $this->_table->find()
            ->select([$this->_table->getPrimaryKey(), $this->getConfig('sortField')])
            ->select($this->getConfig('columnScope'))
            ->order($this->getConfig('defaultOrder'));

        if (!empty($scope)) {
            $records->where($scope);
        }

        $sorts = [];
        foreach ($records as $entity) {
            $individualScope = '';
            foreach ($this->getConfig('columnScope') as $column) {
                $individualScope .= $entity->get($column);
            }

            if (!isset($sorts[$individualScope])) {
                $sorts[$individualScope] = 0;
            }

            $sort = ++$sorts[$individualScope];
            $this->_table->updateAll([
                $this->getConfig('sortField') => $sort,
            ], [
                $this->_table->getPrimaryKey() => $entity->get($this->_table->getPrimaryKey()),
            ]);
        }
    }
471808
public function restore() {
        // if database, import database
        if ($this->_hasDatabaseDump()) {
            $this->restoreDatabase();
        } else {
            // Execute a spawn call in batch mode, to make sure all new columns are there
            $spawnCmd = new Garp_Cli_Command_Spawn();
            $spawnCmd->main(array('b' => true, 'only' => 'db'));
        }

        // set permissions on folders
        $this->setWritePermissions();

        // create snippets
        $this->createSnippets();

        // disable under construction
        Garp_Application::setUnderConstruction(false);
    }
485902
public function afterModelSave()
    {
        Cache::forget($this->getCacheKey());

        try {
            Artisan::call('queue:restart');
        } catch (Exception $e) {
            Log::warning($e->getMessage());
        }
    }
519116
public function resetState()
	{
		parent::resetState();

		// clean temporary db
		$table_name = Config::get('laravel-import-export::baseconf.table_prefix');
		$connection_name = Config::get('laravel-import-export::baseconf.connection_name');
		DB::connection($connection_name)->table($table_name)->truncate();
	}
726139
public function actionRestore()
    {
        $post = Yii::$app->request->post();
        $query = new Query;
        $audit = $query
            ->from("audits.{$post['table']}")
            ->where('audit_id = :audit_id', ['audit_id' => $post['audit_id']])
            ->one();
        $this->setCurrentModel($post['table']);
        $criteria = [];
        /** @var \yii\db\ActiveRecord $model */
        $model = $this->_currentModel;
        foreach ($model->primaryKey() as $primaryKey) {
            $criteria[$primaryKey] = $audit[$primaryKey];
        }
        foreach ($this->module->tables[$post['table']]['updateSkip'] as $column) {
            if (isset($audit[$column])) {
                unset($audit[$column]);
            }
        }
        /** @var \yii\db\ActiveRecord $record */
        $record = $model->findOne($criteria);
        $record->setAttributes($audit, false);
        if ($record->save()) {
            Yii::$app->session->setFlash('success', Yii::t('app', 'Record has been restored.'));
        } else {
            Yii::$app->session->setFlash('danger', Yii::t('app', 'Failed to restore record.'));
        }
        return $this->redirect(Yii::$app->request->referrer);
    }
1206077
public function restore()
     {
         if ($this->isKept) {
             $key = $this->getPKvalue();
             $sql = 'update '.$this->DBtable.' set deleted_at=null where '.$this->keyName." = '".$key."' ";
             //
             if (Database::exec($sql)) {
                 // Code to execute the init the model
             }
         }
     }
1186200
public function restored(Model $entity)
    {
        $data = [
            'database' => $this->getConnectionName(),
            'driver' => $this->getDriverName(),
        ];

        $this->dispatch($this->getRestoreTenantJob($entity, $data));

        return true;
    }