Hallo Sascha,

das geht über Migrations so nur halb... also durch einen
Datenbanktyp-spezifischen Befehl, bspw. so:

create_table :test, :force => true do |t|
  t.column :name, :string
  t.column :address, :string
  t.columns << "status set('public','private') NOT NULL DEFAULT 'public'"
end

Der Befehl "t.columns << ..." fügt dir die Felder an, die du gerne als
Enums hättest... das ist wie gesagt dann aber nicht mehr
Datenbanktyp-unabhängig!

Wichtig außderdem: Der Befehl muss ans Ende des create_table Blocks,
sonst geht es nicht!


  Hoffe das hilft,
  Dennis

--

  Dennis Blöte
  Zentaurenstr. 14
  28199 Bremen

  email : [EMAIL PROTECTED]
  web   : http://dennisbloete.de
  fon   : 0421-5487517
  mobil : 0163-6845699
  skype : Hammerhut

Sascha Teske schrieb:
> Hi Listeners,
> 
> weiss jemand wie ich mit active record und migrations enum felder in
> meine datenbank bekomme? ich hab die tabellen schon und es steckt eben
> ein teil der business logic drin, sodass komplett andere feldtypen
> ("nimm doch ein int und implementiere das mapping in rails") nur die
> "zweitbeste" lösung wären. das auslesen hab ich auch schon, ich wäre
> eben nur gern auch in der lage die tabellen rails konform anzulegen und
> zu ändern.
> 
> danke schonmal für die aufmerksamkeit. viele grüsse
> Sascha
> 
> -- 
> N 53° 33.283 E 010° 02.623
> http://tinyurl.com/2nplah
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> rubyonrails-ug mailing list
> [email protected]
> http://mailman.headflash.com/mailman/listinfo/rubyonrails-ug
begin:vcard
fn;quoted-printable:Dennis Bl=C3=B6te
n;quoted-printable:Bl=C3=B6te;Dennis
adr:;;Zentaurenstr. 14;Bremen;Bremen;28199;Deutschland
email;internet:[EMAIL PROTECTED]
tel;work:+49 421 5 48 75 17
tel;home:+49 421 5 48 75 17
tel;cell:+49 163 6 84 56 99
x-mozilla-html:FALSE
url:http://dennisbloete.de
version:2.1
end:vcard

_______________________________________________
rubyonrails-ug mailing list
[email protected]
http://mailman.headflash.com/mailman/listinfo/rubyonrails-ug

Antwort per Email an