Add the create_column and update_columns to the current table
511098
public function modifyTable()
    {
        foreach ($this->getSingleColumns() as $column)
        {
            if (!$this->getTable()->containsColumn($column))
            {
                $this->getTable()->addColumn(array(
                	'name' => $column,
                    'type' => 'VARCHAR',
                    'size' => '255',
                ));
            }
        }
    }
910740
def _add(self, column):
        
        columns_for_table = self.data.setdefault(column.es_index, {})
        existing_columns = columns_for_table.setdefault(column.name, [])

        for canonical in existing_columns:
            if canonical is column:
                return None
            if canonical.es_type == column.es_type:
                if column.last_updated > canonical.last_updated:
                    for key in Column.__slots__:
                        old_value = canonical[key]
                        new_value = column[key]
                        if new_value == None:
                            pass  # DO NOT BOTHER CLEARING OLD VALUES (LIKE cardinality AND paritiions)
                        elif new_value == old_value:
                            pass  # NO NEED TO UPDATE WHEN NO CHANGE MADE (COMMON CASE)
                        else:
                            canonical[key] = new_value
                return canonical
        existing_columns.append(column)
        return column
56645
protected function _updateColumns ($table_name) {
		$stmt = $this->prepare('SELECT ccu.column_name FROM information_schema.table_constraints tc, information_schema.constraint_column_usage ccu WHERE tc.table_catalog = current_database() AND tc.table_name = ? AND tc.constraint_type = ? AND tc.table_catalog=ccu.table_catalog AND tc.table_schema = ccu.table_schema AND tc.table_name = ccu.table_name AND tc.constraint_name = ccu.constraint_name');
		$stmt->execute([$table_name, 'PRIMARY KEY']);
		$stmt->setFetchMode(\PDO::FETCH_NUM);
		$pkey_column_name = $stmt->fetch();
		$pkey_column_name = isset($pkey_column_name[0]) ? $pkey_column_name : null;

		$comments = [];
		$stmt = $this->prepare('SELECT pa.attname as column_name, pd.description as column_comment FROM pg_stat_all_tables psat, pg_description pd, pg_attribute pa WHERE psat.schemaname = current_schema() AND psat.relname = ? AND psat.relid = pd.objoid AND pd.objsubid <> 0 AND pd.objoid = pa.attrelid AND pd.objsubid = pa.attnum');
		$stmt->execute([$table_name]);
		foreach ($stmt as $comment) {
			$comments[$comment['column_name']] = $comment['column_comment'];
		}

		$pdo_param_list = $this->GetPdoParamList();

		$this->_columns[$table_name] = [];
		$stmt = $this->prepare('SELECT *  FROM information_schema.columns WHERE table_catalog = current_database() AND table_name = ? ORDER BY ordinal_position');
		$stmt->setFetchMode(\PDO::FETCH_ASSOC);
		$stmt->execute([$table_name]);
		foreach ($stmt as $columns) {
			$auto_increment = preg_match("/^nextval\('.+'::regclass\)$/", $columns['column_default']) !== 0;
			$this->_columns[$table_name][$columns['column_name']] = [
				'column_name'		=> $columns['column_name'],
				'type'				=> $columns['data_type'],
				'not_null'			=> filter_var($columns['is_nullable'], FILTER_VALIDATE_BOOLEAN),
				'default'			=> $columns['column_default'],
				'auto_increment'	=> $auto_increment,
				'primary_key'		=> $auto_increment ?: ($pkey_column_name === $columns['column_name']),
				'comment'			=> isset($comments[$columns['column_name']]) ? $comments[$columns['column_name']] : '',
				'raw_data'			=> $columns,
				'pdo_param'			=> $pdo_param_list[explode('(', $columns['data_type'])[0]],
			];
		}
	}
175859
def update(self, table_name, where_slice, new_values):
        
        new_values = quote_param(new_values)

        where_clause = SQL_AND.join([
            quote_column(k) + "=" + quote_value(v) if v != None else quote_column(k) + SQL_IS_NULL
            for k, v in where_slice.items()
        ])

        command = (
            "UPDATE " + quote_column(table_name) + "\n" +
            "SET " +
            sql_list([quote_column(k) + "=" + v for k, v in new_values.items()]) +
            SQL_WHERE +
            where_clause
        )
        self.execute(command, {})
415922
def _set_renamed_columns(self, table_diff, command, column):
        
        new_column = Column(command.to, column.get_type(), column.to_dict())

        table_diff.renamed_columns = {command.from_: new_column}

        return table_diff
946493
def update_where(self, col, value, where_col_list, where_value_list):
        
        if type(col) is str:
            col_ndx = self.get_col_by_name(col)
        else:
            col_ndx = col
        #print('col_ndx = ', col_ndx    )
        #print("updating " + col + " to " , value, " where " , where_col_list , " = " , where_value_list)
        new_arr = self.select_where(where_col_list, where_value_list)
        #print('new_arr', new_arr)
        for r in new_arr:
            self.arr[r[0]][col_ndx] = value
1134596
public function modifyTable()
    {
        if (!$this->getTable()->containsColumn($this->getParameter('deleted_column'))) {
            $this->getTable()->addColumn(array(
                'name' => $this->getParameter('deleted_column'),
                'type' => 'TIMESTAMP'
            ));
        }
    }
72954
def append_column(table, col_name, default_value=None):
    '''
    
    '''
    table[0].append(col_name.strip())
    for row in table[1:]:
        row.append(default_value)
607974
def _update_internal_column_state(self, column_names):
        
        for k in column_names:
            if k not in self._column_name_idx:
                self._column_name_idx[k] = len(self._column_name_list)
                self._column_name_list.append(k)
157370
protected function updateTimestamps()
    {
        $time = $this->freshTimestamp();

        if (! $this->isDirty($this->updatedAtColumn)) {
            $this->setUpdatedAt($time);
        }

        if (! $this->exists && ! $this->isDirty($this->createdAtColumn)) {
            $this->setCreatedAt($time);
        }
    }
1028096
public function updateSQL()
	{
		try{

			//check if table update values are set
			if($this->update_table['drop'] || $this->update_table['rename'])
			{
				//compose query string
				$this->query_string = ($this->update_table['drop']) ? "DROP TABLE IF EXISTS {$this->table};" : "ALTER TABLE {$this->table} RENAME TO {$this->update_table['rename']};";

				return $this;

			}

			//do column updates
			else
			{
				$lines = array();
				$template = "ALTER TABLE %s\n %s;";
				//loop through the columns available
				foreach($this->columns as $column_name => $column)
				{
					//start with less trivial goin upward ADD COLUMN complete DECIMAL(2,1) NULL AFTER description;
					if($column['add'])
					{
						$data_type = $column["type"];//set the column data type

						$length = $column["length"];//set the lenght of the data type

						$primary = ($column["primary"])	? "PRIMARY KEY " : null;//({$column_name})"; //add primary key field

						$index = ($column["index"]) ? "KEY" : null;// {$column_name} ({$column_name})"; //add index field

						switch ($data_type)
						{
							case "autonumber":

								$lines[] = "ADD COLUMN {$column_name} INT(11) NOT NULL AUTO_INCREMENT $primary AFTER {$column['add']}\n";

								break;

							case "text":

								if ($length !== null && $length <= 255)	$lines[] = "ADD COLUMN {$column_name} VARCHAR({$length}) DEFAULT NULL AFTER {$column['add']}\n";

								else $lines[] = "ADD COLUMN {$column_name} text DEFAULT NULL  AFTER {$column['add']}\n";

								break;

							case "integer":

								$lines[] = "ADD COLUMN {$column_name} INT(11) DEFAULT NULL AFTER {$column['add']}\n";

								break;

							case "decimal":

								$lines[] = "ADD COLUMN {$column_name} FLOAT DEFAULT NULL AFTER {$column['add']}\n";

								break;

							case "boolean":

								$lines[] = "ADD COLUMN {$column_name} TINYINT(4) DEFAULT NULL AFTER {$column['add']}\n";

								break;

							case "datetime":

								$lines[] = "ADD COLUMN {$column_name} DATETIME DEFAULT NULL AFTER {$column['add']}\n";

								break;

						}

					}

					elseif($column['update'])
					{

						$data_type = $column["type"];//set the column data type

						$length = $column["length"];//set the lenght of the data type

						$primary = ($column["primary"])	? "PRIMARY KEY " : null;//({$column_name})"; //add primary key field

						$index = ($column["index"]) ? "KEY" : null;// {$column_name} ({$column_name})"; //add index field

						switch ($data_type) //CHANGE COLUMN task_id task_id INT(11) NOT NULL AUTO_INCREMENT;
						{
							case "autonumber":

								$lines[] = "CHANGE COLUMN {$column_name} {$column_name} INT(11) NOT NULL AUTO_INCREMENT $primary\n";

								break;

							case "text":

								if ($length !== null && $length <= 255)	$lines[] = "ADD COLUMN {$column_name} VARCHAR({$length}) DEFAULT NULL\n";

								else $lines[] = "CHANGE COLUMN {$column_name} {$column_name} text DEFAULT NULL\n";

								break;

							case "integer":

								$lines[] = "CHANGE COLUMN {$column_name} {$column_name} INT(11) DEFAULT NULL\n";

								break;

							case "decimal":

								$lines[] = "CHANGE COLUMN {$column_name} {$column_name} FLOAT DEFAULT NULL\n";

								break;

							case "boolean":

								$lines[] = "CHANGE COLUMN {$column_name} {$column_name} TINYINT(4) DEFAULT NULL\n";

								break;

							case "datetime":

								$lines[] = "CHANGE COLUMN {$column_name} {$column_name} DATETIME DEFAULT NULL\n";

								break;

						}
	
					}

					elseif($column['rename'])
					{
						//$lines[] = "CHANGE COLUMN `{$column_name}` `{$column['rename']}`\n";
					}

					elseif($column['drop'])
					{
						$lines[] = "DROP COLUMN {$column['drop']}\n";


					}

				}

				$this->query_string = sprintf($template, $this->table, join(',',$lines));

				return $this;

			}

		}

		catch (MySLQException $err){

			$err->errorShow();

		}

	}
399210
public void addUpdateColumn() {
        if (alreadyContainsColumn(SPUIDefinitions.UPDATE_FILTER_BUTTON_COLUMN)) {
            return;
        }
        deleteColumnIfVisible(SPUIDefinitions.DELETE_FILTER_BUTTON_COLUMN);
        addGeneratedColumn(SPUIDefinitions.UPDATE_FILTER_BUTTON_COLUMN,
                (source, itemId, columnId) -> addUpdateCell(itemId));
    }
1023444
def _update_column_info(self):
		
		del self.columnnames[:]
		del self.columntypes[:]
		del self.columnpytypes[:]
		for child in self.getElementsByTagName(ligolw.Column.tagName):
			if self.validcolumns is not None:
				try:
					if self.validcolumns[child.Name] != child.Type:
						raise ligolw.ElementError("invalid type '%s' for Column '%s' in Table '%s', expected type '%s'" % (child.Type, child.getAttribute("Name"), self.getAttribute("Name"), self.validcolumns[child.Name]))
				except KeyError:
					raise ligolw.ElementError("invalid Column '%s' for Table '%s'" % (child.getAttribute("Name"), self.getAttribute("Name")))
			if child.Name in self.columnnames:
				raise ligolw.ElementError("duplicate Column '%s' in Table '%s'" % (child.getAttribute("Name"), self.getAttribute("Name")))
			self.columnnames.append(child.Name)
			self.columntypes.append(child.Type)
			try:
				self.columnpytypes.append(ligolwtypes.ToPyType[child.Type])
			except KeyError:
				raise ligolw.ElementError("unrecognized Type '%s' for Column '%s' in Table '%s'" % (child.Type, child.getAttribute("Name"), self.getAttribute("Name")))
371707
def change_column_if_table_exists(self,
                                      tablename: str,
                                      oldfieldname: str,
                                      newfieldname: str,
                                      newdef: str) -> Optional[int]:
        """"""
        if not self.table_exists(tablename):
            return None
        if not self.column_exists(tablename, oldfieldname):
            return None
        sql = "ALTER TABLE {t} CHANGE COLUMN {old} {new} {newdef}".format(
            t=tablename,
            old=oldfieldname,
            new=newfieldname,
            newdef=newdef,
        )
        log.info(sql)
        return self.db_exec_literal(sql)
217543
def add_column(self, func, name=None, show=True):
        """"""
        assert func
        name = name or func.__name__
        if name == '<lambda>':
            raise ValueError("Please provide a valid name for " + name)
        d = {'func': func,
             'show': show,
             }
        self._columns[name] = d

        # Update the headers in the widget.
        data = _create_json_dict(cols=self.column_names,
                                 )
        self.eval_js('table.setHeaders({});'.format(data))

        return func
103571
def modify_column(self, table, name, new_name=None, data_type=None, null=None, default=None):
        """"""
        existing_def = self.get_schema_dict(table)[name]

        # Set column name
        new_name = new_name if new_name is not None else name

        # Set data type
        if not data_type:
            data_type = existing_def['Type']

        # Set NULL
        if null is None:
            null_ = 'NULL' if existing_def['Null'].lower() == 'yes' else 'NOT NULL'
        else:
            null_ = 'NULL' if null else 'NOT NULL'

        default = 'DEFAULT {0}'.format(default if default else null_)

        query = 'ALTER TABLE {0} CHANGE {1} {2} {3} {4} {5}'.format(wrap(table), wrap(name), wrap(new_name), data_type,
                                                                           null_, default)
        self.execute(query)
        self._printer('\tModified column {0}'.format(name))
61444
public void insertNewRow() {

        // reset all fields
        for (int i = 0; i < komponente.length; i++) {
            komponente[i].clearContent();
        }    // end of for (int i=0; i<komponente.length; i++)

        // reset the field for the primary keys
        for (int i = 0; i < primaryKeys.length; i++) {
            komponente[pkColIndex[i]].setEditable(true);
        }

        ZaurusEditor.printStatus("enter a new row for table " + tableName);
    }