Documentation ¶
Overview ¶
This file manages schema modification.
There are a couple pieces to this:
1 Each schema modification is in a self contained directory with the a directory name 2. Each modification must contain an 'upgrade.sql' 3. Each modification *may* contain a 'downgrade.sql' script 4. Failure to include a downgrade script means we cannot downgrade past a particular version.
Every revision is stored in a directory named:
rev.<SHA1_HEX>.<description> Each directory contains: (mandatory) prev.txt -- contains the revision code for the previous patch (mandatory) upgrade.sql -- upgrade sql (optional) downgrade.sql -- downgrade sql
Index ¶
- Constants
- Variables
- func GetPatchDirectory(patch_root, revision string) (result string, err error)
- type AvailableStorage
- type DBRcs
- func (self *DBRcs) Changelog(patch_root string) (err error)
- func (self *DBRcs) Close() (err error)
- func (self *DBRcs) ComputeHistory(patch_root string) (err error)
- func (self *DBRcs) CreateNextRev(patch_root string, description string) (prev string, rev string, err error)
- func (self *DBRcs) CurrentDBVersion() (db_ver string, err error)
- func (self *DBRcs) Downgrade(patch_root, version string) (err error)
- func (self *DBRcs) FindLastVersion(patch_root string) (result string, err error)
- func (self *DBRcs) Init(config *util.MzConfig) (err error)
- func (self *DBRcs) InitVersioning() (err error)
- func (self *DBRcs) Upgrade(patch_root string, verbose bool) (err error)
- type Device
- type DeviceList
- type Position
- type Storage
- type Unstructured
Constants ¶
View Source
const (
DB_VERSION = "20140707"
)
Variables ¶
View Source
var AvailableStores = make(AvailableStorage)
View Source
var ErrDatabase = errors.New("Database Error")
View Source
var ErrUnknownDevice = errors.New("Unknown device")
Functions ¶
func GetPatchDirectory ¶
Types ¶
type AvailableStorage ¶
type DBRcs ¶
func (*DBRcs) ComputeHistory ¶
func (*DBRcs) CreateNextRev ¶
func (*DBRcs) CurrentDBVersion ¶
func (*DBRcs) FindLastVersion ¶
func (*DBRcs) InitVersioning ¶
type Device ¶
type Device struct { ID string // device Id User string // userID Name string PreviousPositions []Position HasPasscode bool // is device lockable LoggedIn bool // is the device logged in Secret string // HAWK secret PushUrl string // SimplePush URL Pending string // pending command LastExchange int32 // last time we did anything Accepts string // commands the device accepts AccessToken string // OAuth Access token }
Device information
type DeviceList ¶
type Position ¶
type Position struct { Latitude float64 Longitude float64 Altitude float64 Accuracy float64 Time int64 Cmd map[string]interface{} }
Device position
type Storage ¶
type Storage interface { Init() error RegisterDevice(string, *Device) (string, error) GetDeviceInfo(string) (*Device, error) GetPending(string) (string, string, error) GetUserFromDevice(string) (string, string, error) GetDevicesForUser(string, string) ([]DeviceList, error) StoreCommand(string, string, string) error SetAccessToken(string, string) error SetDeviceLock(string, bool) error PurgePosition(string) error Touch(string) error DeleteDevice(string) error PurgeCommands(string) error Close() GetNonce() (string, error) CheckNonce(string) (bool, error) }
Click to show internal directories.
Click to hide internal directories.