Traccar: Extend Traccar API with new table and column

Martha6 years ago

The creator of Traccar listed 3 steps to add a new column to an existing table:

  1. Add new liquibase changelog.
  2. Add field to Java data model.
  3. Add field to JavaScript data model.

(https://www.traccar.org/forums/topic/add-new-column-in-a-table/#post-41449) and mentioned in another post on how to allow these custom field be reached by the API by looking at existing examples, which it's what I'm doing. (https://www.traccar.org/forums/topic/extending-traccar-api-to-access-custom-tables-queries/)

I'm adding an "emergency contacts" table and adding new column to the device table called "contactid" to reference to the new table, similar to the "positions" table

✓ 1. I've added a new changelog xml file with the new table and new column

✗ 2. I've installed Traccar on Windows, and I don't see these java files. I see them on (https://github.com/traccar/traccar/tree/master/src/org/traccar/model) What should I do???

✓ 3. I've added new JS files; "Contact.js" on (https://github.com/traccar/traccar-web/tree/master/web/app/model) and "Contacts.js" on (https://github.com/traccar/traccar-web/tree/master/web/app/store) and modified Device.js with new fields.

Please, help!!

John6 years ago

For question 2,
You cant see source files if you install Traccar on windows. You have to build the source files. See https://www.traccar.org/build/ for how to do it.