Skip to content
This repository has been archived by the owner on Aug 13, 2021. It is now read-only.

Registers with only id #28

Open
luidones opened this issue Dec 1, 2015 · 2 comments
Open

Registers with only id #28

luidones opened this issue Dec 1, 2015 · 2 comments

Comments

@luidones
Copy link

luidones commented Dec 1, 2015

I dont know why, but sails-memory generates registries inside collections with nothing but an id.
image

Worse than that, it generates registries undefined
image

(added console.log(this.data[collectionName]); at line 499 of lib/database.js)
image

@particlebanana
Copy link
Contributor

What does your model look like? The only way these would get in is if you have timestamps turned off with no required attributes and do a create (possibly through blueprints) so that a record is created.

@luidones
Copy link
Author

luidones commented Dec 1, 2015

Hi particlebanana,

I'm sorry that I forgot print that out. Here's my model.
.: by the way, i'm using waterline outside sails (stand-alone)

_employees = Waterline.Collection.extend
    identity: 'employees'
    connection: settings.defaultConnection or 'default'
    tableName: 'Employees'
    schema: yes
    attributes:
        name:
            type: 'string'
            required: yes
            minLength: 5
            maxLength: 100
        birthdate:
            type: 'date'
            required: yes
        federalDocument:
            type: 'string'
            required: yes
            minLength: 14
            maxLength: 14
        stateDocument:
            type: 'string'
            required: yes
            maxLength: 14
        stateDocumentIssuer:
            type: 'string'
            required: yes
            maxLength: 8
        post:
            type: 'string'
            maxLength: 30
        bank:
            type: 'integer'
        bankBranch:
            type: 'integer'
        accountNumber:
            type: 'integer'
        remarks:
            type: 'text'
        homeAddress:
            model: 'employeesAddresses'
        billingAddress:
            model: 'employeesAddresses'
        phones:
            collection: 'employeesPhones'
            via: 'employee'
        office:
            model: 'offices'

_employeesAddresses = Waterline.Collection.extend
    identity: 'employeesAddresses'
    connection: settings.defaultConnection or 'default'
    tableName: 'EmployeesAddresses'
    schema: yes
    attributes:
        zip: 
            type: 'integer'
            required: yes
        address: 
            type: 'string'
            required: yes
            maxLength: 250
        city: 
            type: 'string'
            required: yes
            maxLength: 100
        state: 
            type: 'string'
            required: yes
            maxLength: 2

_employeesPhones = Waterline.Collection.extend
    identity: 'employeesPhones'
    connection: settings.defaultConnection or 'default'
    tableName: 'EmployeesPhones'
    schema: yes
    attributes:
        type:
            type: 'integer'
            enum: (t for i, t of phoneTypes)
            required: yes
        number:
            type: 'integer'
            required: yes
        employee:
            model: 'employees'

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants