= Data Layer =

== Synchronization ==

First, note that the data here is quite small and won't usually take a noticeable percentage of the available bandwidth (per month for phones) IF AND ONLY IF we keep the chatter to a minimum. Hence we will base all of our synchronization 

 1. Each table will have a last updated timestamp. 
 1. Each registered device will be listed in a table and the last updated timestamp for each device will be listed. 
 1. Each actual change will be stored as a row on the device and include a timestamp and a CRUD operation object.

== Tables ==

Clearly we must have tables for the following:

 * Topics
 * Beliefs
 * Verses
 * Devices
 * Licenses

For the first three, the question is:

 * '''Question''': How long does the string holding the topic need to be? '''''Decision''''': 50 --> varchar(50).
 * '''Question''': How long does the string holding the belief need to be? '''''Decision''''': Since beliefs may be quite lengthy, we are using ''text'', which is stored separately etc.
 * '''''Decision''''': Verses are a 3-tuple of integer values. Since both chapters and verses are integers starting at 1, all values will be 1-based. E.g. Genesis 1:1 is identified by (1,1,1).


See the create.sql file in the project for the most recent.