# Help escaping column name in a migration file

**URL:** <https://www.ruby-forum.com/t/help-escaping-column-name-in-a-migration-file/112668>\
**Category:** Rails\
**Created:** [August 21, 2007, 11:54pm UTC](https://www.ruby-forum.com/t/help-escaping-column-name-in-a-migration-file/112668 "2007-08-21T23:54:03Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![eggie5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7c8e57/32.png) [@eggie5](https://www.ruby-forum.com/u/eggie5)\
**Post date:** [August 21, 2007, 11:54pm UTC](https://www.ruby-forum.com/t/help-escaping-column-name-in-a-migration-file/112668/1 "2007-08-21T23:54:03Z")

</div>

My DB column is name “3gp”, but the below is invalid syntax. How can i  
express this in ruby?

class CreateVideos \< ActiveRecord::Migration  
def self.up  
create\_table :videos do |t|  
t.column :x, :integer  
t.column :y, :integer  
t.column :max\_time, :integer  
t.column :max\_file, :integer  
t.column :mp4, :integer  
t.column :3gp, :integer //how do this?  
end  
end

def self.down  
drop\_table :videos  
end  
end

---

<div class="post-metadata">

**Author:** ![eggie5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7c8e57/32.png) [@eggie5](https://www.ruby-forum.com/u/eggie5)\
**Post date:** [August 22, 2007, 1:10am UTC](https://www.ruby-forum.com/t/help-escaping-column-name-in-a-migration-file/112668/2 "2007-08-22T01:10:28Z")

</div>

> class CreateVideos \< ActiveRecord::Migration  
> def self.up  
> create\_table :videos do |t|  
> t.column :x, :integer  
> t.column :y, :integer  
> t.column :max\_time, :integer  
> t.column :max\_file, :integer  
> t.column :mp4, :integer  
> t.column :3gp, :integer //how do this?  
> end  
> end

```
 t.column '3gp', :integer

```

or perhaps you could use a different name

---

<div class="post-metadata">

**Author:** ![eggie5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7c8e57/32.png) [@eggie5](https://www.ruby-forum.com/u/eggie5)\
**Post date:** [September 25, 2007, 11:08pm UTC](https://www.ruby-forum.com/t/help-escaping-column-name-in-a-migration-file/112668/3 "2007-09-25T23:08:00Z")

</div>

On Aug 20, 2007, at 8:19 PM, eggie5 wrote:

> ```
> t.column :3gp, :integer //how do this?
> 
> ```

I know it’s not the most natural sounding thing in the world but is  
it heresy in Rails to just name it something like :video3gp  
or :format3gp instead of :3gp?

- Cliff

---

<div class="post-metadata">

**Author:** ![eggie5](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/7c8e57/32.png) [@eggie5](https://www.ruby-forum.com/u/eggie5)\
**Post date:** [September 25, 2007, 11:09pm UTC](https://www.ruby-forum.com/t/help-escaping-column-name-in-a-migration-file/112668/4 "2007-09-25T23:09:12Z")

</div>

I would use your later suggestion as rails will attempt to create  
accessor / mutator methods for this column, and method names can not  
start with a number.

Cliff P. wrote:

> - Cliff
> 
> >

–  
Sincerely,

William P.
