Naoray / blueprint-nova-addon

A Blueprint addon which generates Nova resources
MIT License
71 stars 37 forks source link

Use id or primary keys as identifiers to allow for string primary key #16

Closed antoniopaisfernandes closed 4 years ago

antoniopaisfernandes commented 4 years ago

Use id or primary keys as identifiers to allow for string primary key to be used

Naoray commented 4 years ago

@antoniopaisfernandes could you explain the use case for this?

antoniopaisfernandes commented 4 years ago

Hi there,

Simple use case that works with blueprint:

models:
    PartBrand:
        id: string primary
        name: string
        default_lead_time: integer

    Part:
        id: string primary
        search_number: string:26 index
        part_brand_id: string index

Intended use case that works with blueprint (note the number of chars):

models:
    PartBrand:
        id: string:3 primary
        name: string
        default_lead_time: integer

    Part:
        id: string:20 primary
        search_number: string:26 index
        part_brand_id: string:3 index

Best regards

Naoray commented 4 years ago

Ok, thanks! Would you be willing to write a test for this?

antoniopaisfernandes commented 4 years ago

Sure! :) Will do.

antoniopaisfernandes commented 4 years ago

Hi,

Can you please check it out? I could extract some logic to a method but, being a trait, I didn't want to pollute the method surface.

Best regards

Naoray commented 4 years ago

@antoniopaisfernandes going to close this PR in a week

antoniopaisfernandes commented 4 years ago

Yeah... go ahead. Couldn't find time to address it :(

Naoray commented 4 years ago

@antoniopaisfernandes I'd have helped if you helped me understand. Sorry..