Managing DB Schema

This is covers various concepts for managing the changes in the DB schema utilized by Sqloo:

Adding a new field

When adding a new column to a DB table you will want to add synced equals false before pushing to production. After the all db's have been synced, then you can remove the synced property from the new field. This flow prevents errors from attempting to query a table with the new field when it hasn't been synced yet.

Step 1: Example

"tax_id" => [
	Sqloo::COLUMN_DATA_TYPE => array( "type" => Sqloo::DATATYPE_STRING, "size" => 48 ),
	Sqloo::COLUMN_DEFAULT_VALUE => "",
	"synced"=>FALSE
],

Step 2

Commit and push to production, then sync the db schema by running: https://sabramedia.com/action/admin/core/sync-all

Step 3: Example

Set synced to TRUE or just remove the line, then commit and push to production. Now the field is usable.

"tax_id" => [
	Sqloo::COLUMN_DATA_TYPE => array( "type" => Sqloo::DATATYPE_STRING, "size" => 48 ),
	Sqloo::COLUMN_DEFAULT_VALUE => "",
	"synced"=>TRUE // OR just remove this line
],