[Rails] How to generate mapping with migration

Daniel Völkerts d.voelkerts at gmx.de
Fri Apr 7 16:04:17 GMT 2006


Daniel Völkerts schrieb:

> Any hints appreciated,

Ohh, read the api carefully.

class AddNotesCategoriesMapping < ActiveRecord::Migration
   def self.up
		create_table :categories_notes, :id=>false do |t|
			t.column :category_id, :primary_key, :null=>false
			t.column :note_id, :primary_key, :null=>false
		end
   end

   def self.down
		drop_table :categories_notes
   end
end

Greetings,

-- 
Daniel Völkerts
Protected by Anti Pesto. -- Wallace & Gromit


More information about the Rails mailing list