mardi 30 septembre 2014

How to create a join_table with a specific table name? (RAILS)


Vote count:

0




I have been given the unenviable task of moving from Postgres to Oracle. (Very very sad. Not my call). When I run rake db:migrate, rails throws an Oracle error ORA-00972: identifier is too long. How can I specify the table_name in the migration so that it is less than the 30 character limit imposed by Oracle?


The following is an example taken from: http://ift.tt/1vvO7C0


and yields a table name: products_categories


class CreateJoinTableProductsCategories < ActiveRecord::Migration def change create_join_table :products, :categories do |t| # t.index [:product_id, :category_id] # t.index [:category_id, :product_id] end end end


I want to do something like this, specifying the join_table name, to yield the join table name of "myjointablename":


class CreateJoinTableProductsCategories < ActiveRecord::Migration def change create_join_table :products, :categories, table_name: :myjointablename do |t| # t.index [:product_id, :category_id] # t.index [:category_id, :product_id] end end end


But it is not liking it very much.... I would appreciate any help.... cheers!



asked 43 secs ago







How to create a join_table with a specific table name? (RAILS)

Aucun commentaire:

Enregistrer un commentaire