Hello!
I’ve a table called users and I would like to create unique indexes on two fields :phone and :email.
create unique_index(:users, [:phone, :email] and
create unique_index(:users, [:phone]) create unique_index(:users, [:email])
are one and the same?
Sorry, if I sound too naive, I’m still learning Ecto and Postgres, also I would be grateful if you could please recommend resources for learning to work with Postgres
It will create a unique index where you cannot have a value with both the phone and email identical. For example, you could have two records with the same email, but not two records with the same email and the same phone.
I haven’t been around resources to learn that stuff in a long time. I’d say something like https://www.postgresqltutorial.com/ should do the job, at the very least to get you up and running with PostgreSQL. Of course, going down the road of learning from Postgres own documentation would be a good idea, but it might not be easy to start with.