I'm switching from MySQL to PostgreSQL and trying to add a UNIQUE INDEX.
Command that I ran in MySql:
create UNIQUE index idx_friendship_userid_friend_id on Friendship(owner_id, friend_id);
Command that I think is equivalent to above in PostgreSQL:
CREATE UNIQUE INDEX idx_friendship_userid_friend_id ON public."Friendship" USING btree (owner_id, friend_id);
Are the two commands equivalent or am I doing something wrong?
publicyou can omit the schema qualification too. AndBTREEis already the default index option so you don't need to specify that. In short there are good chances that you don't need to change the statement at all and can use the one from MySQL. But why don't you just try any of them and see if they work? If you get an error than you can come back with it and we can help more accurately.