<commit_before>
             
   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
     - type must be 'string|number'
  - hasSchema
  - identity
  - tableName
  - datastore
  - attributes.ATTR_NAME:
     - type 'string|number|boolean|json|ref':
        - required unless ATTR.model|collection
        - forbidden if ATTR.model
     - model
     - collection
     - autoCreatedAt
     - autoUpdatedAt
     - defaultsTo
     - required BOOL
  - meta OBJ
  - fetchRecordsOnUpdate BOOL (def: false)
  - fetchRecordsOnDestroy BOOL (def: false)
  - cascadeOnDestroy BOOL (def: false)

SCHEMA.MODEL_NAME:
  - copied from MODEL_DEF: primaryKey, schema (renamed 'hasSchema'), identity, tableName, datastore, attributes, meta,
    fetchRecordsOnUpdate, fetchRecordsOnDestroy, cascadeOnDestroy
  - schema: originally from MODEL_DEF.attributes

Waterline.Model

Waterline.getModel()
















             
   WATERLINE  
             <commit_msg>no commit message<commit_after>
             
   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  
             
{'fraction_non_alphanumeric': 0.21635394950196896, 'fraction_numerical': 0.00034746351633078526, 'mean_word_length': 2.375684128225176, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '359855', 'n_tokens_mistral': 6186, 'n_tokens_neox': 6082, 'n_words': 505}