Alter the tables
421592
def handle(self, *args, **options):
        
        from categories.migration import drop_field
        if 'app_name' not in options or 'model_name' not in options or 'field_name' not in options:
            raise CommandError("You must specify an Application name, a Model name and a Field name")

        drop_field(options['app_name'], options['model_name'], options['field_name'])
1261106
public function change() {
		$table = $this->table('queue_processes');

		$table->changeColumn('pid', 'string', [
			'length' => 40,
			'null' => false,
			'default' => null,
			'encoding' => 'utf8mb4',
			'collation' => 'utf8mb4_unicode_ci',
		]);

		$table->save();
	}
884227
public function modifyDatabase()
    {
        foreach ($this->getTables() as $table) {
            if ($table->hasBehavior($this->getId())) {
                // don't add the same behavior twice
                continue;
            }
            $behavior = clone $this;
            $table->addBehavior($behavior);
        }
    }
106636
public function modifyTable()
    {
        $table = $this->getTable();

        if (!$table->containsColumn($this->getParameter('rank_column'))) {
            $table->addColumn(array(
                'name' => $this->getParameter('rank_column'),
                'type' => 'INTEGER'
            ));
        }
        if ($this->useScope() && !$this->hasMultipleScopes() &&
             !$table->containsColumn($this->getParameter('scope_column'))) {
            $table->addColumn(array(
                'name' => $this->getParameter('scope_column'),
                'type' => 'INTEGER'
            ));
        }

        if ($this->useScope()) {
            $scopes = $this->getScopes();
            if (0 === count($scopes)) {
                throw new \InvalidArgumentException(sprintf(
                    'The sortable behavior in `%s` needs a `scope_column` parameter.',
                    $this->getTable()->getName()
                ));
            }
            foreach ($scopes as $scope) {
                $keys = $table->getColumnForeignKeys($scope);
                foreach ($keys as $key) {
                    if ($key->isForeignPrimaryKey() && $key->getOnDelete() == ForeignKey::SETNULL) {
                        $foreignTable = $key->getForeignTable();
                        $relationBehavior = new SortableRelationBehavior();
                        $relationBehavior->addParameter(array('name' => 'foreign_table', 'value' => $table->getName()));
                        $relationBehavior->addParameter(array('name' => 'foreign_scope_column', 'value' => $scope));
                        $relationBehavior->addParameter(array('name' => 'foreign_rank_column', 'value' => $this->getParameter('rank_column')));
                        $foreignTable->addBehavior($relationBehavior);
                    }
                }
            }
        }
    }
213664
protected void updateTables()
   {
      byte[] data = m_model.getData();
      int columns = m_model.getColumns();
      int rows = (data.length / columns) + 1;
      int offset = m_model.getOffset();

      String[][] hexData = new String[rows][columns];
      String[][] asciiData = new String[rows][columns];

      int row = 0;
      int column = 0;
      StringBuilder hexValue = new StringBuilder();
      for (int index = offset; index < data.length; index++)
      {
         int value = data[index];
         hexValue.setLength(0);
         hexValue.append(HEX_DIGITS[(value & 0xF0) >> 4]);
         hexValue.append(HEX_DIGITS[value & 0x0F]);

         char c = (char) value;
         if ((c > 200) || (c < 27))
         {
            c = ' ';
         }

         hexData[row][column] = hexValue.toString();
         asciiData[row][column] = Character.toString(c);

         ++column;
         if (column == columns)
         {
            column = 0;
            ++row;
         }
      }

      String[] columnHeadings = new String[columns];
      TableModel hexTableModel = new DefaultTableModel(hexData, columnHeadings)
      {
         @Override public boolean isCellEditable(int r, int c)
         {
            return false;
         }
      };

      TableModel asciiTableModel = new DefaultTableModel(asciiData, columnHeadings)
      {
         @Override public boolean isCellEditable(int r, int c)
         {
            return false;
         }
      };

      m_model.setSizeValueLabel(Integer.toString(data.length));
      m_model.setHexTableModel(hexTableModel);
      m_model.setAsciiTableModel(asciiTableModel);
      m_model.setCurrentSelectionIndex(0);
      m_model.setPreviousSelectionIndex(0);
   }
1178486
def tablerename(tablename, newtablename):
    
    t = table(tablename, ack=False)
    t.rename(newtablename)
934344
public function modifyTable()
    {
        $table = $this->getTable();

        if ($this->withCreatedAt() && !$table->hasColumn($this->getParameter('create_column'))) {
            $table->addColumn([
                'name' => $this->getParameter('create_column'),
                'type' => 'TIMESTAMP'
            ]);
        }
        if ($this->withUpdatedAt() && !$table->hasColumn($this->getParameter('update_column'))) {
            $table->addColumn([
                'name' => $this->getParameter('update_column'),
                'type' => 'TIMESTAMP'
            ]);
        }
    }
743351
def add_table(self, dataframe, isStyled = False):
        """"""

        if isStyled :
            table_string = dataframe.render()
        else :
            table_string = dataframe.style.render()
            
        table_string = table_string.replace("\n", "").replace("<table", """<table class = "table table-sm table-hover" """).replace("<thead>", """<thead class="thead-inverse">""")
        self.table = table_string
511084
def change_column_length(table: Table, column: Column, length: int, engine: Engine) -> None:
    
    if column.type.length < length:
        print("Changing length of {} from {} to {}".format(column, column.type.length, length))
        column.type.length = length
        column_name = column.name
        column_type = column.type.compile(engine.dialect)
        engine.execute('ALTER TABLE {table} ALTER COLUMN {column_name} TYPE {column_type}'.format(**locals()))
172331
def alter_add_column(self, table, column_name, field, **kwargs):
        """"""
        name = field.name
        op = super(SchemaMigrator, self).alter_add_column(table, column_name, field, **kwargs)
        if isinstance(field, pw.ForeignKeyField):
            field.name = name
        return op
1227673
public function alterTable(TableDiff $tableDiff)
    {
        $queries = $this->_platform->getAlterTableSQL($tableDiff);
        if (! is_array($queries) || ! count($queries)) {
            return;
        }

        foreach ($queries as $ddlQuery) {
            $this->_execSql($ddlQuery);
        }
    }
658586
private void updateTable()
  {
    try
    {
      tableModel = new DefaultTableModel(new String[]
        {
          "name", "id", "text", "tokens", "source_path"
        }, 0);
      tableList.setModel(tableModel);

      List<Map<String, Object>> stats = corpusAdmin.listCorpusStats();

      for(Map<String, Object> map : stats)
      {
        String[] rowData = new String[tableModel.getColumnCount()];
        for(int j = 0; j < rowData.length; j++)
        {
          String cName = tableList.getColumnName(j);
          if(map.containsKey(cName))
          {
            rowData[j] = map.get(cName).toString();
          }
          else
          {
            rowData[j] = "";
          }
        }

        tableModel.addRow(rowData);
      }
    }
    catch(Exception ex)
    {
      ImportStatus importStatus = corpusAdmin.getAdministrationDao().initImportStatus();
      importStatus.addException("list corpora exception", ex);
      new ExceptionDialog(importStatus).setVisible(true);
    }
  }
82056
def rename_tables(db, table_mapping, reverse=False):
    
    from django.db import connection
    if reverse:
        table_mapping = [(dst, src) for src, dst in table_mapping]
    table_names = connection.introspection.table_names()
    for source, destination in table_mapping:
        if source in table_names and destination in table_names:
            print(u"    WARNING: not renaming {0} to {1}, because both tables already exist.".format(source, destination))
        elif source in table_names and destination not in table_names:
            print(u"     - renaming {0} to {1}".format(source, destination))
            db.rename_table(source, destination)
1161523
def create_tables(c):
    """"""
    # auto_shape_types ---------------------
    c.execute(
        'DROP TABLE IF EXISTS auto_shape_types'
    )
    c.execute(
        'CREATE TABLE auto_shape_types (\n'
        '    id         integer,\n'
        '    prst       text,\n'
        '    const_name text,\n'
        '    base_name  text,\n'
        '    ms_name    text,\n'
        '    desc       text\n'
        ')\n'
    )
    c.execute(
        'DROP TABLE IF EXISTS adjustment_values'
    )
    c.execute(
        'CREATE TABLE adjustment_values (\n'
        '    prst     text,\n'
        '    seq_nmbr integer,\n'
        '    name     text,\n'
        '    val      integer\n'
        ')\n'
    )
280299
def transform(fields, function, *tables):
    ""

    new_table = Table(fields=fields)

    for table in tables:
        for row in filter(bool, map(lambda row: function(row, table), table)):
            new_table.append(row)

    return new_table
1368623
private function alterTable($tableDiff)
    {
        if ($this->getSqlStatements) {
            $this->addSql($this->getPlatform()->getAlterTableSQL($tableDiff));
        } else {
            $this->schemaManager->alterTable($tableDiff);
        }
    }
415266
def set_table(self, table):
        
        super(MultiField, self).set_table(table)
        if self.field and self.field.table is None:
            self.field.set_table(self.table)