MerginMaps / db-sync

A tool for two-way synchronization between Mergin Maps and a PostGIS database
https://merginmaps.com
MIT License
45 stars 20 forks source link

To ID or FID - that is the question #137

Closed northrivergeo closed 4 months ago

northrivergeo commented 6 months ago

I have a postgresql/postgis database (14.11/3.4).

I set up DB Sync and it works. IN my database I have ID as my Primary key. DB Sync creates a geopackage without an FID and ID is a required field. When I go to Enter data on my phone it prompts me to manually save the Primary key.

So when I set up the QGZ file - I can turn off ID as a required field. Record data. It works. ID is ignored. When it syncs back to the database - ID is properly filled out.

If I change the database and make ID field FID (My new Primary key is FID) - I don't have to make any changes and everything works out of the box.

I'm not even sure if this is a bug or normal.

Should db sync make an FID field in the geopackage? Should my Primary key become FID to smooth out the process? Is it up to the user to fix it in the QGZ file? I really am leaning toward "this is intended behavior and the user needs to switch off the primary key in the QGZ/db_sync.gpkg file to smooth out data collection".

northrivergeo commented 4 months ago

So if I hide the ID in the QGZ file it's not a problem.