Question: I have a class definition that is part of a class definition.

```
var someObject = {
   someClass: function() {
      this.someMethod = function() {
         alert('hello');
      };
   }
}

```

I have been told that I should use prototype to add methods, as it then only needs to be created once for all instances of the object. The problem is that it seems I need to add the prototyped method *after* the constructor function is defined, like this...

```
var someObject = {
   someClass: function() {

   }
}

someObject.someClass.prototype.someMethod = function() {
   alert('hello');
};

```

Ideally however I would like to define the prototyped methods within the constructor function like this...

```
var someObject = {
   someClass: function() {
      this.prototype.someMethod = function() {
         alert('hello');
      };
   }
}

```

This causes an error however stating that prototype is null or not an object. Is there a way to accomplish what I would like, or is this not possible?

Answer: 
Renaming a column (with `ALTER TABLE ... CHANGE COLUMN`) unfortunately requires MySQL to run a full table copy.

Check out [pt-online-schema-change](http://www.percona.com/doc/percona-toolkit/pt-online-schema-change.html). This helps you to make many types of ALTER changes to a table without locking the whole table for the duration of the ALTER. You can continue to read and write the original table while it's copying the data into the new table. Changes are captured and applied to the new table through triggers.

Example:

```
pt-online-schema-change h=localhost,D=databasename,t=tablename \
  --alter 'CHANGE COLUMN oldname newname NUMERIC(9,2) NOT NULL'

```

---

*Update:* MySQL 5.6 can do some types of ALTER operations without rebuilding the table, and changing the name of a column is one of those supported as an online change. See <http://dev.mysql.com/doc/refman/5.6/en/innodb-create-index-overview.html> for an overview of which types of alterations do or don't support this.
If there aren't any constraints on it, you can alter it without a hassle as far as I know. If there are you'll have to remove the constraints first, alter and add the constraints back.