postgresql - Does Heroku support foreign key and unique constraints? -


i'm considering moving rails app heroku.

in general add fk constraints on delete behavior fks. i've done writing raw sql add constraints, rails migrations don't provide way that.

i add unique keys needed.

will still able add constraints in way if move heroku?

another way put question be, direct access db heroku, or limited can in migrations?

you can execute sql want in migration using connection.execute, example:

def     connection.execute(%q{         alter table t add constraint c check (x in ('a', 'b', 'c'))     }) end def down     connection.execute('alter table t drop constraint c') end 

you can use foreigner add proper fk support migrations , schema.rb if don't want manage fks through raw sql.

you can use :unique => true option add_index unique constraints/indexes.

i've done of , added functions (both sql , pl/pgsql) , triggers dedicated postgresql database @ heroku. i'm not sure how supported on shared databases unique indexes , i'm pretty sure fks , checks available well.


Comments

Popular posts from this blog

jquery - Invalid Assignment Left-Hand Side -

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -