cds-pg
cds-pg copied to clipboard
use snaky case for table name / view name
convert table and column name to snaky case
Hi Colleagues, by default, table name / view name / column name in PostgresQL is case sensitive. So the normal way is to either use double quote to quote name so that name in SQL express can be directly mapped to name in database. Or alternatively, we use snaky case, so that every letter is in lower case and every word is split by underscore. The current status of this project, will simply removing all underscore in table name and replace dot with underscore between different object. E.g. definition in cds: PurchaseOrder.DeliveryAddress will be traslate into database object: purchaseorder_deliveryaddress
After translation, the name become unreadable. Ideally, we should get purchase_order_delivery_address or purchase_order__delivery_address
perhaps we can use similar way like Spring. https://www.baeldung.com/hibernate-field-naming-spring-boot
Predefine some naming strategy and let developer decide which one to use. In this case, we will need capire to support it.
Hi @clockrun,
thank you for your suggestion. Have you tried running the tests localy before an after your changes? As you can see the tests are failing in CI.
KR, Gregor
Hi Gregor, Yes, that's something we need to discuss. SInce the naming convention has changed, all those unit test need to be rewrite. Let's confirm the design and then update test case.
Regards, Clockrun
thanks for being onboard 🙏 - but cds-pg
sailed has sailed into the official SAP harbor and become a bigger boat ⛵️😄
https://github.com/cap-js/cds-dbs/tree/main/postgres
Please continue contributing there!