Read about OpenEMR's Response to the COVID-19 Pandemic at

Adding new pharmacies in DB. How to generate the ID?

I’ve got a list of pharmacies that I need to add to the database. I’ve written a little script that will insert the pharmacies and then the address. I was thinking (hoping) that the value was just auto-incremented, but that does not appear to be the case.

There seems to be some shared/common ID generator somewhere in the app/DB? Can someone tell me how IDs are generated for pharmacies, addresses, and phone_numbers?


I think I figured this out. I found the sequences table and am using that for the IDs in pharmacies, phone_numbers, and addresses.

However I cannot see the pharmacy associated with the practice. How/where do I associate a pharmacy with a specific practice? Or if that type of association does not exist, how do I get them to show up in the list inside the app?

Thanks in advance for any help here.

Looks like my address insert was bad. I had the wrong foreign ID. There is no additional config needed here. Just get your data right in those 3 tables.