-
Notifications
You must be signed in to change notification settings - Fork 16
/
waterline.node.txt
544 lines (468 loc) · 31.9 KB
/
waterline.node.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
WATERLINE
new Waterline()->ORM
Waterline.start(OPTS, FUNC())
- OPTS:
- models.MODEL_NAME MODEL_DEF
- datastores.DATASTORE_NAME DATASTORE_DEF
- adapters.ADAPTER_NAME ADAPTER
- defaultModelSettings OBJ: deep defaults to MODEL_DEF
Waterline.stop(ORM, FUNC())
ADAPTER:
- identity 'ADAPTER_NAME'
- defaults OBJ: applied to DATASTORE_DEF
DATASTORE_DEF:
- adapter 'ADAPTER_NAME'
DATASTORE:
- config DATASTORE_DEF
- adapter 'ADAPTER_NAME'
- collections ARR
MODEL_DEF:
- tableName 'TABLE_NAME' (def: 'MODEL_NAME')
- identity 'MODEL_NAME' (def: 'TABLE_NAME')
- primaryKey 'ATTR_NAME':
- required
- cannot use autoCreatedAt|autoUpdatedAt|defaultsTo|allowNull
- type must be 'string|number'
- schema BOOL
- datastore
- attributes.ATTR_NAME:
- type 'string|number|boolean|json|ref'
- model 'MODEL_NAME':
- cannot use type
- pointed MODEL must have a primaryKey
- collection 'MODEL_NAME':
- cannot use type|required
- via 'OTHER_ATTR_NAME':
- used with ATTR.collection, to target OTHER_MODEL.OTHER_ATTR
- OTHER_ATTR.foreignKey might be used
- def: 'ATTRNAME_OTHERATTRNAME'
- through 'MODEL_NAME'
- dominant BOOL:
- used together with ATTR.collection + ATTR.via
- pick which of the two collections is dominant
- def: random one is picked
- autoMigrations OBJ:
- columnType 'string|number|boolean|json|ref'
- with ATTR.model 'MODEL_NAME'
- def to that MODEL primaryKey
- autoCreatedAt|autoUpdatedAt BOOL:
- cannot be both
- type must be 'string|number'
- cannot use required|defaultsTo
- defaultsTo:
- cannot use required|model|collection
- required BOOL
- allowNull BOOL:
- type cannot be 'json|ref'
- cannot use autoCreatedAt|autoUpdatedAt|required|defaultsTo
- meta
- validations
- description
- columnName 'COL_NAME' (def: 'ATTR_NAME')
- meta OBJ
- fetchRecordsOnUpdate BOOL (def: false)
- fetchRecordsOnDestroy BOOL (def: false)
- cascadeOnDestroy BOOL (def: false)
SCHEMA.MODEL_NAME:
- copy of MODEL_DEF, except:
- schema -> hasSchema
- add 'schema':
- like MODEL_DEF.attributes:
- ATTR.columnName not removed
- foreign keys:
- when ATTR.model 'OTHER_MODEL_NAME' is specified
- transform ATTR to OBJ:
- foreignKey true
- columnName CURRENT_ATTR.columnName
- autoMigrations CURRENT_ATTR.autoMigrations
- type CURRENT_ATTR.autoMigrations.columnType
- model 'OTHER_MODEL_NAME'
- references OTHER_MODEL.tableName
- referenceIdentity 'OTHER_MODEL_NAME'
- onKey OTHER_MODEL_NAME.PRIMARY_KEY_ATTR
- on OTHER_MODEL_NAME.PRIMARY_KEY_ATTR.columnName
- join tables:
- when ATTR.collection 'OTHER_MODEL_NAME' is specified, but not ATTR.through
- uses ATTR.via to target OTHER_MODEL.OTHER_ATTR
- not if OTHER_ATTR.foreignKey is defined
- builds JSONTABLESCHEMA
- transform ATTR to OBJ:
- collection 'OTHER_MODEL_NAME'
- references 'MODELNAME_ATTRNAME__OTHERMODELNAME_OTHERATTRNAME'
- referencesIdentity 'MODELNAME_ATTRNAME__OTHERMODELNAME_OTHERATTRNAME'
- on 'MODELNAME_ATTRNAME'
- onKey 'MODELNAME_ATTRNAME'
- at the moment I am here:
- https://github.com/balderdashy/waterline-schema/blob/master/lib/waterline-schema/joinTables.js#L147
- with variable `joinTables`, being JSONTABLESCHEMA_ARR:
- duplicate JSONTABLESCHEMA with same identity are removed
- JSONTABLESCHEMA is:
- identity|tableName 'MODELNAME_ATTRNAME__OTHERMODELNAME_OTHERATTRNAME'
- tables: ['MODEL_NAME', 'OTHER_MODEL_NAME']
- joinedAttributes ['MODELNAME_ATTRNAME', 'OTHERMODELNAME_OTHERATTRNAME']
- junctionTable true
- meta OBJ: merge of MODEL.meta and OTHER_MODEL.meta (with the dominant one having priority)
- datastore: MODEL.datastore (of the dominant collection)
- primaryKey: 'id'
- attributes.ATTR with:
- id: type 'number', columnName 'id', required: false, autoMigrations: { columnType: 'integer', unique: true, autoIncrement: true }
- MODELNAME_ATTRNAME:
- foreignKey true
- columnName 'MODELNAME_ATTRNAME'
- type PRIMARY_KEY_ATTR.type
- model 'MODEL_NAME'
- references MODEL.tableName
- referencesIdentity 'MODEL_NAME'
- on PRIMARY_KEY_ATTR.columName
- onKey PRIMARY_KEY_ATTR.columName
- groupKey 'MODEL_NAME'
- required true
- autoMigrations OBJ:
- columnType PRIMARY_KEY_ATTR.autoMigrations.columnType
- OTHERMODELNAME_OTHERATTRNAME: same but for OTHER_MODEL
Waterline.Model
Waterline.getModel()
WATERLINE
I STARTED UPDATING THIS DOC BUT DID NOT FINISH
GOAL ==> #ORM for many types of databases
#Version 0.10.1
/=+===============================+=\
/ : : \
)==: CONCEPTS :==(
\ :_______________________________: /
\=+===============================+=/
ADAPTER #Plugin doing the abstraction for a specific database
ADAPTER_CONFOBJ #Options to ADAPTER (such as datastore params)
DATASTORE #ADAPTER + ADAPTER_CONFOBJ
TABLE_OBJ #Abstraction of a TABLE.
# - identity TABLENAME:
# - table name, used in the application code
# - required
# - def: use tableName
# - must be lowercase
# - tableName STR:
# - as opposed to TABLENAME, name used by the ADAPTER
# - def: use identity
# - datastore 'DATASTORE'[_ARR]:
# - if ARR, each DATASTORE can add new methods, with the leftmost having priority
# - def: WATERLINE.initialize() OBJ.datastores.default
# - schema BOOL:
# - if false, can create|update columns not in TABLE_OBJ.attributes.COL
# - default to ADAPTER.schema BOOL:
# - true for SQL databases, otherwise it would create errors (reference non existing cols)
# - false for noSQL databases, but can be turned to true: columns not references will be
# silently not used
# - primaryKey 'COL':
# - required
# - COL must:
# - be STR|NUM
# - use either required|autoIncrement true
# - not use defaultsTo|autoCreatedAt|autoUpdatedAt|allowNull
# - autoPk BOOL (def: true): ADAPTER create|handle attribute "id"
# - [attributes.COL.]autoCreated|UpdatedAt BOOL (def: true): ADAPTER create|handle attribute "createdAt|updatedAt"
# - [attributes.COL.]meta OBJ???
# - fetchRecordsOnUpdate|Destroy BOOL (def: false)???
# - attributes.COL:
# - "COL" cannot contain dots
# (???)
# - required BOOL (def: false):
# - forbidden if COL.collection|defaultsTo|allowNull|autoCreatedAt|autoUpdatedAt specified
# - allowNull BOOL???
# - forbidden if COL.type 'json|ref' or COL.model|collection|autoCreatedAt|autoUpdatedAt|defaultsTo specified
# - description???
# (hints for the ADAPTER, used also at application layer)
# - type: "string|number|boolean|json|ref":
# - required, unless COL.collection specified
# - forbidden if COL.model specified
# - columnName STR:
# - use 'COL' as the application layer, but STR for the ADAPTER
# - both STR and 'COL' must exist in the database.
# 'COL' will not be automatically created by ADAPTER
# (other hints, link to relations (see RES_OBJ.populate()))
# - model TABLENAME:
# - foreign key to TABLENAME primaryKey
# - can use attributes.COL.autoMigrations OBJ???
# - columnType STR (def: primaryKey type)
# - collection TABLENAME and via 'COL2':
# - inverse: hint that current primary key is referenced by TABLENAME.COL2 foreign key
# - as opposed to model TABLENAME, 'COL' without populate() is not an id, it is just empty
# - TABLENAME.COL2 must:
# - have model TABLENAME2 if one-to-many relationship
# - have collection TABLENAME2 and via 'COL' (def: 'COL2_TABLENAME2') if many-to-many relationship
# - the underlying table name:
# - called TABLENAME_COL__TABLENAME2_COL2
# - has COL: id (primaryKey, type 'number'), TABLENAME_COL (foreign key), TABLENAME2_COL2 (foreign key)
# - the underlying database can e.g. create a third join table for
# represent that relationship
# - one of the two 'COL[2]' must also use dominant true, to indicate
# which primary key to use in the join table
# - through TABLENAME???
# (not done by ADAPTER)
# - defaultsTo VAL:
# - forbidden if COL.model|collection|autoCreatedAt|autoUpdatedAt
# (validations members)
# - validations???
# - how:
# - emits error on create|update (not find|destroy) if not validated
# - can also call RES_OBJ.validate(FUNC(ERROR))
# - done by ADAPTER according to TABLE_OBJ.migrate STR:
# - "alter" (def): change non-validated data
# - "drop"
# - "safe": do not do anything
# - can be:
# - TYPE BOOL
# - number, finite, array BOOL
# - binary BOOL: BUFFER or STR
# - empty BOOL: object.keys(OBJ)|ARR|STR.length == 0
# - falsey|truthy BOOL: !VAL and !!VAL
# - VAR BOOL (based on VALIDATOR):
# - "alpha[numeric]|numeric", "email", "url", "ip[v4|6]", "uuid", "creditcard"
# "json", "hexadecimal", "hexcolor", "lower|uppercase"
# - alpha[numeric]dashed BOOL: [a-zA-Z[0-9]-_]
# - after|before DATE
# - equals STR
# - contains|notContains STR
# - min|maxLength NUM
# - min|max NUM
# - greaterThan|lessThan NUM
# - in|notIn ARR|STR
# - enum STR_ARR: same as in
# - regex|notRegex REGEXP: partial matching
# - can also be:
# - VAR()->BOOL
# - same as VAR, but supply argument with return value
# - can use other this.COL
# - VAR(FUNC(...)): same but async, must call FUNC(...) instead of returning it
# - FUNC VAL2, where FUNC is defined at TABLE_OBJ.types.FUNC(VAL, VAL2)->BOOL
# - before|afterValidate|Create|Update|Destroy|Find[One](NEW_ROW_OBJ, FUNC([ERROR])):
# - event handlers:
# - Validate: on create|update
# - Create
# - Update
# - Destroy
# - Find[One]
# - before* can modify NEW_ROW_OBJ
# - FUNC([ERROR]) is async callback
# - beforeDestroy(CRIT_OBJ, FUNC), afterDestroy(FUNC): same but on destroy
# - FUNC(...): custom function that can be called as RES_OBJ.FUNC(...), using RES_OBJ as this
ROW_OBJ #Abstraction of a ROW. Members are COL: VAL
NEW_ROW_OBJ #Same but id|createdAt|updatedAt have not been creates yet
RES_OBJ #TABLE_OBJ + DATASTORE, with methods to manipulate the TABLE
/=+===============================+=\
/ : : \
)==: INIT :==(
\ :_______________________________: /
\=+===============================+=/
INIT ==> #What follows is init sequence
new Waterline() #
Waterline.Model.
extend(TABLE_OBJ)->MODEL #
WATERLINE.registerModel(MODEL)#Builds the models
WATERLINE.initialize #Starts the adapters
(OBJ, FUNC(ERROR, OBJ2)) #OBJ:
# - datastores.DATASTORE:
# - adapter: 'ADAPTER'
# - ADAPTER_CONFOBJ members
# - DATASTORE can be "default"
# - adapters.ADAPTER ADAPTER
# - defaults TABLE_OBJ
#OBJ2:
# - [datastores.DATASTORE.]collections.TABLENAME RES_OBJ
# - datastores.DATASTORE: OBJ.datastores.DATASTORE + ADAPTER.defaults
#ERROR: if wrong input or wrong TABLE_OBJ
WATERLINE.teardown(FUNC(EROR))#Inverse.
#Specifically: calls each ADAPTER.teardown()
Waterline.start #Like:
(OBJ. FUNC(ERROR, WATERLINE)) # - WATERLINE = new Waterline()
# - Waterline.Model.extend(TABLE_OBJ)->MODEL
# - WATERLINE.registerModel(MODEL)
# - WATERLINE.initialize(...)
#OBJ:
# - models.TABLENAME TABLE_OBJ_ARR (TABLENAME is used as TABLE_OBJ.identity)
# - defaultModelSettings OBJ: deep defaults for TABLE_OBJ
# - datastores, adapters, defaultModelSettings (not defaults): passed to WATERLINE.initialize()
#WATERLINE.collections|datastores = (initialize()'s) OBJ2.collections|datastores
Waterline.stop
(WATERLINE, FUNC(ERROR)) #Like WATERLINE.teardown()
Waterline.getModel #OBJ is either WATERLINE (if used Waterline.start()) or OBJ2 (if used WATERLINE.initialize())
('TABLENAME', OBJ)->RES_OBJ #Throws error if cannot find
/=+===============================+=\
/ : : \
)==: RUNTIME :==(
\ :_______________________________: /
\=+===============================+=/
RES_OBJ.* #All TABLE_OBJ properties
RES_OBJ.*() #All following methods returns Bluebird PROMISE mixed with RES_OBJ methods:
# - resolved with ROW_OBJ[_ARR] (not ARR if findOne() or create() (except with ARR)), or
# rejected with ERROR
# - is chainable
#Can also pass FUNC(ERROR, ROW_OBJ[_ARR]) or use PROMISE.exec(FUNC(ERROR, ROW_OBJ[_ARR]), including following methods???
#Exception: RES_OBJ.query()
RES_OBJ.find([CRIT_OBJ]) #Resolved with matching ROW_OBJ_ARR
RES_OBJ.findOne([CRIT_OBJ]) #Same as find(), except:
# - do limit(1)
# - resolved with ROW_OBJ, not ROW_OBJ_ARR
# - must at least specify one criteria in CRIT_OBJ
RES_OBJ.count([CRIT_OBJ]) #Same as find().length
RES_OBJ.create
(NEW_ROW_OBJ[_ARR]) #Create new ROW_OBJ, and resolves with it|them
RES_OBJ.createEach()???
RES_OBJ.findOrCreate
(CRIT_OBJ, NEW_ROW_OBJ[_ARR]) #Like findOne(CRIT_OBJ), but if can't find anything, do RES_OBJ.create(NEW_ROW_OBJ[_ARR])
RES_OBJ.update
([CRIT_OBJ, ]NEW_ROW_OBJ) #Modifies a ROW_OBJ (matching CRIT_OBJ), and resolves with it
RES_OBJ.destroy([CRIT_OBJ]) #Erases a ROW_OBJ, then resolves with it. Can erase several???
RES_OBJ.where(CRIT_OBJ) ???
RES_OBJ.limit|skip(NUM) ???
RES_OBJ.sort(OBJ|STR) ???
RES_OBJ.avg|sum(...) #Same as specifying CRIT_OBJ.sum|average in RES_OBJ.*()
RES_OBJ.paginate ???
({ page: UINT, limit: UIN2 }) #Same as limit(UINT2).skip(UINT*UINT2). Def UINT2 is 10, def UINT is 0
RES_OBJ.addToCollection(???)
RES_OBJ.removeToCollection(???)
RES_OBJ.replaceToCollection(???)
RES_OBJ.populate ??? #Replace a foreign key with the rows it references, or inverse, for COL:
('COL'[, CRIT_OBJ]) # - with model TABLENAME:
# - Replaces 'COL' by ROW_OBJ from TABLENAME, using 'COL' id as foreign key
# and using TABLENAME primary key
# - 1 foreign key -> 1 primary key
# - If references a non existing primary key, fills with empty OBJ
# - with collection TABLENAME2 and via 'COL2':
# - Replaces 'COL' by all ROW_OBJ from TABLENAME2, using 'COL2' as foreign key and
# using ROW_OBJ primary key
# - 1 primary key -> n foreign keys
# - can filter further with CRIT_OBJ
ROW_OBJ.save #Saves modifications to ROW_OBJ
(FUNC(ERROR, ROW_OBJ)) #Only present works if TABLE_OBJ has at least one attribute with model|collection|via
#To modify a ROW_OBJ.VAR that has been populate()'d with collection|via (not model), use:
# - ROW_OBJ.VAR.add(NEW_ROW_OBJ or ID_NUM|STR[_ARR]) (will use current primary key as default foreign key)
# - ROW_OBJ.VAR.remove(ID_NUM|ID_STR)
ROW_OBJ.destroy(FUNC(ERROR)) #Erases ROW_OBJ (only works if populate() was called)
RES_OBJ.stream([CRIT_OBJ]) #Like find(), but returns a OSTREAM not a promise.
#Not implemented by most ADAPTER, and bugs with SAILS-POSTGRESQL
RES_OBJ.query ??? #Perform native SQL command STR (only for SQL ADAPTER, should check it is and provide fallback).
(STR, [STR2_ARR,] FUNC(ERROR, OBJ)) #Uses a callback not promises.
#STR2_ARR are injected into STR, after SQL escaping, using notation $NUM (Postgres) or ? (MySQL)
#OBJ:
# - command (e.g. "SELECT")
# - rows ROW_OBJ_ARR
# - rowCount NUM
# - fields OBJ_ARR:
# - name STR: of the column
# - format STR: type of the column
# - columnID NUM
# - tableID NUM
RES_OBJ.native ???
(FUNC(ERROR, MCOLL)) #Gets MongoDB collection
The following are gone???
RES_OBJ.
find[One]ByCOL[Like](VAL) #Shortcut: like using RES_OBJ.find[One]({ COL: VAL or { like: VAL } })
#'COL' is camelcased
RES_OBJ.countByCOL[Like](VAL) #Same but returns length of ARR
CRIT_OBJ #Search criteria:
# - is case insensitive
# - members:
# - where WHERE_OBJ:
# - COL VAL: equals VAL[_ARR]
# - COL OBJ:
# - '<|<=|>|>=' NUM[_ARR]
# - '!' VAL[_ARR]: not equal
# - 'like' STR: use globbing wildcard %
# - 'contains|startsWith|endWith' STR: same as 'like' '%STR%', '%STR', 'STR%'
# - arrays means "or", except for '!' where it means "and"
# - or WHERE_OBJ_ARR: alternatives
# - limit NUM: only first NUM elements
# - skip NUM: skip first NUM elements
# - sort:
# - OBJ { COL: 1|0 ... }
# - 1 is asc, 0 desc
# - STR "COL asc|desc": same if only one
# - min|max|sum|average 'COL'[_ARR]:
# - find() only
# - return aggregation of rows that would normally be returned
# - can use groupBy 'COL'[_ARR] to group the aggregation
# - only return columns specified in min|max|sum|average and groupBy
# - shortcuts:
# - WHERE_OBJ -> { where: WHERE_OBJ }
# - STR|NUM -> { where: { id: STR|NUM } }
# - nothing -> matches all
ROW_OBJ.toJSON() #Returns clone.
#Can redefine TABLE_OBJ.attributes.COL.toJSON()->OBJ:
# - should manipulate and return this.toObject() ROW_OBJ
# - use it to customize cloned objects, e.g. removing some fields
/=+===============================+=\
/ : : \
)==: ADAPTERS :==(
\ :_______________________________: /
\=+===============================+=/
ADAPTER #OBJ with members:
# - identity 'ADAPTER'
# - pkFormat STR: among types above
# - schema BOOL: default value of schema (see above)
# - syncable BOOL
# - migrate STR
# - defaults ADAPTER_CONFOBJ
# - registerDatastore|teardown|describe|define|drop|join|create|find|update|destroy|native
# |addAttribute|removeAttirbute|createEach|stream: FUNC to reimplement
ALL ==> #Create tables, sequences, etc. if not already existing. Otherwise reuse them.
SAILS-REDIS ==> #Version 0.10.0-rc2.
#Uses REDIS.createClient(ADAPTER_CONFOBJ.port, ADAPTER_CONFOBJ.host, ADAPTER_CONFOBJ)
# .auth(ADAPTER_CONFOBJ.password)
#How:
# - uses "pseudo-tables" waterline:TABLENAME, where only rows are stored:
# - ROW_OBJ is ROW_JSON_STR waterline:TABLENAME:id:ID
# - all rows id of a table saved at ROW_SET waterline:TABLENAME:id
# (with all keys of ROW_JSON_STR)
# - there should be primary keys
# - types: correspond to JSON type: "STR|STR|INT|DOUBLE|DATE|invalid|BOOL|ARR|OBJ"
# - constraints:
# - unique|primaryKey: uses SET waterline:TABLENAME:_indicies:COL
# - autoIncrement: uses STR waterline:TABLENAME:_sequences:COL
# - index|size|model|collection|via: nothing
# - auto:
# - autoPK: adds a 'COL' "id" INT with autoIncrement and primaryKey, that can't be updated
# - createdAt|updatedAt: adds 'COL' "createdAt|updatedAt" DATE
# - actions:
# - find[One]: smembers ROW_SET and get ROW_JSON_STR
# - create: sadd ROW_SET and set ROW_JSON_STR
# - update: like find + create
# - destroy: srem ROW_SET and del ROW_JSON_STR
# - CRIT_OBJ: done by ADAPTER
SAILS-MONGO ==> #Version 0.10.5. Documentation not done yet.
SAILS-POSTGRESQL ==> #Version 0.10.0-rc4
#Uses PG.connect(ADAPTER_CONFOBJ)
#How:
# - use tables TABLENAME (join table TABLENAME_COL__TABLENAME2_COL2)
# - types: "text|text|integer|double precision|timetz|timestamptz|bool|bytea|text|json"
# - constraints:
# - primaryKey: primary key
# - index: btree index
# - autoIncrement: serial
# - unique: unique + btree index
# - size: nothing
# - model|collection|via: nothing
# - auto:
# - autoPK: column "id" serial pkey
# - createdAt|updatedAt: columns "createdAt|updatedAt" timestamptz
# - actions:
# - find[One]|count: select
# - create|update|destroy: insert|update|destroy ... returning *
# - CRIT_OBJ:
# - where: where COL OP VAL [or ...]
# - limit: limit
# - skip: offset
# - sort: order by
# - groupby: group by
# - sum|min|max|average: sum|min|max|avg()
SAILS-MEMORY ==> #Version 0.10.1
#Store everything in memory only.
#Good for starting developing application layer before database ready, but not good for prod.
SAILS-DISK ==> #Version 0.10.3
#Same as SAILS-MEMORY but write to filesystem as JSON file, at DIR ADAPTER_CONFOBJ.filePath
#(def: "./.tmp/") and file ADAPTER_CONFOBJ.identity + ".db" (def: 'DATASTORE')
SAILS-REST ==> #Makes REST calls: see online doc