Changes between Version 9 and Version 10 of DeveloperGuidelines/EdenMobile/Database
- Timestamp:
- 02/24/17 12:21:58 (6 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DeveloperGuidelines/EdenMobile/Database
v9 v10 77 77 == Default Schema == 78 78 79 The database schema is stored ''in'' in the database itself, in the {{{em_schema}}} table.79 The database schema is stored in the mobile database, in the {{{em_schema}}} table. 80 80 81 For the initial setup of the database, a static {{{emDefaultSchema}}} (in www/ js/modules/schema.js) is used:81 For the initial setup of the database, a static {{{emDefaultSchema}}} (in www/config/schema.js) is used. Once this schema has been written to the new database, it will be ignored. 82 82 83 {{{ 84 #!js 85 var emSchemaVersion = '1'; 86 87 var emDefaultSchema = { 88 89 /** 90 * Table to store the current schema version 91 */ 92 'em_version': { 93 'version': { 94 type: 'string', 95 label: 'Version', 96 notnull: true 97 }, 98 _records: [ 99 {'version': emSchemaVersion} 100 ] 101 }, 102 103 /** 104 * Table to store table schemas 105 */ 106 'em_schema': { 107 'name': { 108 type: 'string', 109 label: 'Name', 110 notnull: true 111 }, 112 'schema': { 113 type: 'json', 114 label: 'Schema', 115 notnull: true 116 } 117 } 118 }; 119 }}} 120 121 Once this schema has been written to the new database, it will be ignored. 122 83 The {{{emDefaultSchema}}} service also defines the meta-fields which are to be added to all user tables. 123 84 == emSQL == 124 85