# Rails Migrations and database views

**URL:** <https://www.ruby-forum.com/t/rails-migrations-and-database-views/147136>\
**Category:** Rails\
**Created:** [August 28, 2008, 6:37pm UTC](https://www.ruby-forum.com/t/rails-migrations-and-database-views/147136 "2008-08-28T18:37:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sinoda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aeb1de/32.png) [@sinoda](https://www.ruby-forum.com/u/sinoda)\
**Post date:** [August 28, 2008, 6:37pm UTC](https://www.ruby-forum.com/t/rails-migrations-and-database-views/147136/1 "2008-08-28T18:37:51Z")

</div>

I have a DB2 schema with many ‘views’ and table partitions defined in  
it. As per our new project requirement we have to support multiple  
databases (DB2,Oracle and MYSQL to be specific). The frontend  
application is implemented using Ruby on Rails. I am interested in  
exploring the possibility of using Rails Migrations to abstract out  
the schema to a DB independent layer. I could not find any reference  
material on the web on how I can apply Rails Migrations on a schema  
containing ‘views’ and table partitions? Can anyone help me? Thanks in  
advance.

---

<div class="post-metadata">

**Author:** ![sinoda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aeb1de/32.png) [@sinoda](https://www.ruby-forum.com/u/sinoda)\
**Post date:** [August 28, 2008, 6:49pm UTC](https://www.ruby-forum.com/t/rails-migrations-and-database-views/147136/2 "2008-08-28T18:49:33Z")

</div>

On Thu, Aug 28, 2008 at 12:14 PM, sinoda [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I have a DB2 schema with many ‘views’ and table partitions defined in  
> it. As per our new project requirement we have to support multiple  
> databases (DB2,Oracle and MYSQL to be specific). The frontend  
> application is implemented using Ruby on Rails. I am interested in  
> exploring the possibility of using Rails Migrations to abstract out  
> the schema to a DB independent layer. I could not find any reference  
> material on the web on how I can apply Rails Migrations on a schema  
> containing ‘views’ and table partitions? Can anyone help me? Thanks in  
> advance.

Sinoda,

I have a project called rails\_sql\_views on github that might be  
helpful. It was extracted from the work I was doing on ActiveWarehouse  
and has been extended by others. At the moment it does not have an  
implementation for DB2, however you could implement the  
implementation. The repo is at:  
[http://github.com/aeden/rails\_sql\_views/tree/master](http://github.com/aeden/rails_sql_views/tree/master)

Sincerely,  
Anthony E.

---

<div class="post-metadata">

**Author:** ![sinoda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/aeb1de/32.png) [@sinoda](https://www.ruby-forum.com/u/sinoda)\
**Post date:** [August 28, 2008, 7:06pm UTC](https://www.ruby-forum.com/t/rails-migrations-and-database-views/147136/3 "2008-08-28T19:06:33Z")

</div>

Thank you Anthony.
