Forum: Ruby on Rails PostgreSQL datatypes equivalent when scaffolding

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
The N. (Guest)
on 2008-10-23 20:16
(Received via mailing list)
Hi, I'm trying to make a scaffold for my test application using
PostgreSQL 8.3 database. and I remembered on an article for MySQL it
uses :string for VARCHAR, :integer for INT, and :text for TINYTEXT,
TEXT, MEDIUMTEXT, or LONGTEXT2.

Is there any datatype equivalent with PostgreSQL?

My database is like this

workers:
id serial (primary key)
first_name character(50)
last_name character(50)

users:
id serial (primary key)
username character(20)
password character(20)
id_personnel integer(11) (foreign key related with the 'id' field of
the 'workers' table)

Additionally, is there a way to import or, rather, migrate the tables'
properties (their fields and datatypes) to rails? If there is any,
that would be great, because my database is created and would like to
use it without doing the "rake db:migrate" thing.

I hope I'm not asking too much. Thanks in advance.

Greetings...
The N.
Fernando P. (Guest)
on 2008-10-24 13:33
Migrations in Rails are independent from your DB. I have successfully
migrated a Rails app from MySQL to PostgreSQL without having to change a
single line of migration.
The N. (Guest)
on 2008-10-24 17:08
(Received via mailing list)
On Oct 25, 4:33 am, Fernando P. <removed_email_address@domain.invalid>
wrote:
> Migrations in Rails are independent from your DB. I have successfully
> migrated a Rails app from MySQL to PostgreSQL without having to change a
> single line of migration.
> --
> Posted viahttp://www.ruby-forum.com/.

And what about constraint (primary and foreign keys) and things like
that. I know ":string" really mean "character varying" and I need the
equivalent of the "character" data type, which is not present in the
Rails's data type.

I hope to be wrong but another alternative would be to use the
"execute" command followed by the SQL query. Is  it possible to do so
as mentioned in this article?
http://www.robbyonrails.com/articles/2005/11/11/ra....
(Yeah I know it's old but it can work on my project's migrations)

Later...

The N.
This topic is locked and can not be replied to.