Show the changes in the database
488179
public function showChangesAction()
    {
        $patchLevels = $this->db->fetchPairs('SELECT DISTINCT gpa_level, gpa_level FROM gems__patches ORDER BY gpa_level DESC');

        $searchData['gpa_level'] = reset($patchLevels);

        if ($this->request instanceof \Zend_Controller_Request_Abstract) {
            $searchData = $this->request->getParams() + $searchData;
        }

        $snippet = $this->addSnippet(
                'Database\\StructuralChanges',
                'patchLevels', $patchLevels,
                'searchData', $searchData
                );

        if (1 == $this->request->getParam('download')) {
            $snippet->outputText($this->view, $this->_helper);
        }
    }
494514
public function updateDateModified()
    {
        $dateModified = Core::make('date')->toDB();
        $db = Database::connection();
        $db->update('TreeNodes', ['dateModified' => $dateModified], ['treeNodeID' => $this->getTreeNodeID()]);
    }
246745
public function writeChanges()
    {
        foreach ($this->pendingOperations as $targetPath => $templateData) {
            if (isset($templateData['contents'])) {
                $this->fileManager->dumpFile($targetPath, $templateData['contents']);

                continue;
            }

            $this->fileManager->dumpFile(
                $targetPath,
                $this->getFileContentsForPendingOperation($targetPath, $templateData)
            );
        }

        $this->pendingOperations = [];
    }
1208626
def _update(self):
        """"""
        self.dataChanged.emit(self.createIndex(0, 0), self.createIndex(
            len(self.collection), len(self.header)))
894815
public function hasChanges(): bool
    {
        foreach ($this->getTables() as $table) {
            if ($table->getComparator()->hasChanges()) {
                return true;
            }
        }

        return false;
    }
914947
public function change() {
		$table = $this->table('queued_tasks');

		try {
			$adapter = new MysqlAdapter([]);
			if ($adapter->getSqlType('text', 'longtext')) {
				$table->changeColumn('data', 'text', [
					'limit' => MysqlAdapter::TEXT_LONG,
					'null' => true,
					'default' => null,
				]);

				$table->save();
			}
		} catch (Exception $e) {
			Debugger::dump($e->getMessage());
		}
	}
191865
public function change()
    {
        $table = $this->table('widgets');
        $table->changeColumn('trashed', 'datetime', [
            'default' => null,
            'null' => true,
        ]);
        $table->update();

        // Update existing records to set null for non-deleted ones
        // NOTE: cast to char is needed for the mysql 5.7*!
        $count = $this->execute('UPDATE widgets SET trashed=NULL WHERE CAST(trashed AS CHAR(20)) = "0000-00-00 00:00:00"');
    }
656643
def table_absent(name, db):
    '''
    
    '''
    changes = {'name': name,
               'changes': {},
               'result': None,
               'comment': ''}
    conn = None
    try:
        conn = sqlite3.connect(db, detect_types=sqlite3.PARSE_DECLTYPES)
        tables = _query(conn, "SELECT sql FROM sqlite_master " +
                              " WHERE type='table' AND name=?", [name])

        if len(tables) == 1:
            if __opts__['test']:
                changes['result'] = True
                changes['comment'] = "'" + name + "' will be dropped"
            else:
                conn.execute("DROP TABLE " + name)
                conn.commit()
                changes['changes']['old'] = tables[0][0]
                changes['result'] = True
                changes['comment'] = "'" + name + "' was dropped"
        elif not tables:
            changes['result'] = True
            changes['comment'] = "'" + name + "' is already absent"
        else:
            changes['result'] = False
            changes['comment'] = "Multiple tables with the same name='" + \
                                 name + "'"

    except Exception as e:
        changes['result'] = False
        changes['comment'] = six.text_type(e)

    finally:
        if conn:
            conn.close()

    return changes
819405
def show_dbs():
    

    l = []
    mc = client_connector()
    if not mc:
        # The client couldn't connect
        return ()

    dbs = mc.database_names()
    for d in dbs:
        dbc = mc[d]
        collections = dbc.collection_names()
        collections = remove_values_from_list(collections, "system.indexes")
        l.append({"name": d, "collections": collections})
    return tuple(l)
98679
public function change()
    {
		$table = $this->table('comment');
        $table->addColumn('external', 'boolean', array(
            'null' => false,
            'after' => 'article',
			'default' => 0,
		))
		->addColumn('pending', 'boolean', array(
            'null' => false,
            'after' => 'active',
			'default' => 0,
			'comment' => 'Pending approval',
        ))
        ->addColumn('spam', 'boolean', array(
            'null' => false,
            'after' => 'active',
			'default' => 0,
        ))
        ->addColumn('name', 'string', array(
            'null' => true,
            'after' => 'user',
            'length' => 32,
        ))
        ->addColumn('ip', 'string', array(
            'null' => true,
            'after' => 'timestamp',
            'length' => 30,
        ))
        ->addColumn('referer', 'string', array(
            'null' => true,
            'after' => 'ip',
            'length' => 300,
        ))
        ->addColumn('useragent', 'string', array(
            'null' => true,
            'after' => 'referer',
            'length' => 300,
        ))
        ->addColumn('email', 'string', array(
            'null' => true,
            'after' => 'useragent',
            'length' => 300,
        ))
		->addIndex(array('name'))
		->addIndex(array('pending'))
        ->save(); 
    }
255287
def update_sql(table, filter, updates):
    '''
    
    '''
    where_keys, where_vals = _split_dict(filter)
    up_keys, up_vals = _split_dict(updates)
    changes = _pairs(up_keys, sep=', ')
    where = _pairs(where_keys, start=len(up_keys) + 1)
    sql = 'UPDATE {} SET {} WHERE {}'.format(
        table, changes, where)
    return sql, up_vals + where_vals
248436
def _notify_change(self, model, attr, old, new, hint=None, setter=None, callback_invoker=None):
        ''' 

        '''
        # if name changes, update by-name index
        if attr == 'name':
            if old is not None:
                self._all_models_by_name.remove_value(old, model)
            if new is not None:
                self._all_models_by_name.add_value(new, model)

        if hint is None:
            serializable_new = model.lookup(attr).serializable_value(model)
        else:
            serializable_new = None

        event = ModelChangedEvent(self, model, attr, old, new, serializable_new, hint, setter, callback_invoker)
        self._trigger_on_change(event)
765258
def show():
    """"""
    env = get_environment()

    for key, val in sorted(env.env.items(), key=lambda item: item[0]):
        click.secho('%s = %s' % (key, val))
1056752
def OnTableChanged(self, event):
        """"""

        if hasattr(event, 'updated_cell'):
            # Event posted by cell edit widget.  Even more up to date
            #  than the current cell's contents
            self.ignore_changes = True
            try:
                self.SetValue(event.updated_cell)

            except TypeError:
                # None instead of string present
                pass
            self.ignore_changes = False

        else:
            current_cell = self.main_window.grid.actions.cursor
            current_cell_code = self.main_window.grid.code_array(current_cell)

            if current_cell_code is None:
                self.SetValue(u"")
            else:
                self.SetValue(current_cell_code)

        event.Skip()
1224687
def changed(self):
        """"""
        if not self.instance.pk:
            return {}
        saved = self.saved_data.items()
        current = self.current()
        return dict((k, v) for k, v in saved if v != current[k])
893768
def changes(self, columns=None, recurse=True, flags=0, inflated=False):
        
        output = {}
        is_record = self.isRecord()
        schema = self.schema()
        columns = [schema.column(c) for c in columns] if columns else \
                   schema.columns(recurse=recurse, flags=flags).values()

        context = self.context(inflated=inflated)
        with ReadLocker(self.__dataLock):
            for col in columns:
                old, curr = self.__values.get(col.name(), (None, None))
                if col.testFlag(col.Flags.ReadOnly):
                    continue
                elif not is_record:
                    old = None

                check_old = col.restore(old, context)
                check_curr = col.restore(curr, context)
                try:
                    different = check_old != check_curr
                except StandardError:
                    different = True

                if different:
                    output[col] = (check_old, check_curr)

        return output
1200648
public function change() {
		$this->table('queue_processes')
			->changeColumn('created', 'datetime', ['null' => false, 'default' => null])
			->changeColumn('modified', 'datetime', ['null' => false, 'default' => null])
			->update();

		$this->table('queued_jobs')
			->changeColumn('created', 'datetime', ['null' => false, 'default' => null])
			->update();
	}