Database Building Utility Functions
These functions can be used to:
- create a new table based on a supplied Right Track Table Schema
- load the table with the data from the specified source file
- add a specified set of initial data to a table
- Source:
Methods
(inner) add(db, table, values, callback)
- Source:
Add the specified values into the table
Parameters:
Name | Type | Description |
---|---|---|
db |
object | SQLite database being built |
table |
RTTableSchema | The Right Track Table Schema |
values |
Array.<object> | List of data to add to table. Each object is a set
of data keypairs where the property name is the column header name and the
value is the data value to add. Property names must match field names as
specified in the |
callback |
buildTableCallback | Callback function called when the data has been added |
(inner) create(db, table, callback)
- Source:
Create the table in the database, along with indices and foreign keys
Parameters:
Name | Type | Description |
---|---|---|
db |
object | SQLite Database being built |
table |
RTTableSchema | The Right Track Table Schema |
callback |
buildTableCallback | Callback function called when create is finished |
(inner) init(db, table, agencyOptions, callback)
- Source:
Initialize the Table in the database. This will drop an existing table, create a new one (along with any specified indices and/or foreign key relationships) and import the data from the table's source file.
Parameters:
Name | Type | Description |
---|---|---|
db |
object | SQLite Database being built |
table |
RTTableSchema | The Right Track Table Schema |
agencyOptions |
AgencyOptions | The Agency Build Options |
callback |
buildTableCallback | Callback function called when init is finished |
(inner) load(db, table, agencyOptions, callback)
- Source:
Load the source file into the database
Parameters:
Name | Type | Description |
---|---|---|
db |
object | SQLite database being built |
table |
RTTableSchema | The Right Track Table Schema |
agencyOptions |
AgencyOptions | Agency Build Options |
callback |
buildTableCallback | Callback function called when load is finished |