Nubie: primary key to span more than 1 field

Nubie: primary key to span more than 1 field

Postby Rolf » Wed May 25, 2016 10:10 pm

Database tables should have a primary key. nubuilderPro takes care of that behind the scenes, especially with the FastForms that I currently am using a lot as an entry point to my nubuilder learning curve.

I've already been toying with the database fields that were created by FastForms and switched field types, etc., to be more in line with my plans. One thing I'd like to do is have a table where the primary key consists of more than one field (think about First Name, Family Name, Birthday and Birthplace fields in the Persons table, for example). I tried to put "first, family, birthday, birthplace" in the "Primary Key" field on the "Home - NuBuilder Form - Nubuilder Form - General" tab (separate fields by comma), but that didn't work.

Does nuBuilder support a primary key to span more than 1 field and if so, how to do it?
Rolf
 
Posts: 28
Joined: Fri May 20, 2016 4:54 pm

Re: Nubie: primary key to span more than 1 field

Postby admin » Thu May 26, 2016 10:59 am

Rolf,

Sorry, no it doesn't.

Steven
admin
Site Admin
 
Posts: 3348
Joined: Mon Jun 15, 2009 9:53 am

Re: Nubie: primary key to span more than 1 field

Postby Rolf » Thu May 26, 2016 4:43 pm

Thank you again for the quick response.

I tried another approach or workaround which was to CONCAT the fields in question into a new field in a MySQL view and use that for the form. But it seems that nuBuilder does not support forms to be based on views or does it? I always get "Form Wizard can't detect Primary Key on selected table." even when the concatination is left out and the view is simply a "SELECT * FROM table".

I guess I'll simply let nuBuilder have its PK as a separate field to keep it happy and then use an index in MySQL over the fields in question to make sure there are no duplicates.
Rolf
 
Posts: 28
Joined: Fri May 20, 2016 4:54 pm

Re: Nubie: primary key to span more than 1 field

Postby admin » Tue May 31, 2016 9:17 am

Rolf,

That's what I would do.

Steven
admin
Site Admin
 
Posts: 3348
Joined: Mon Jun 15, 2009 9:53 am

Re: Nubie: primary key to span more than 1 field

Postby Rolf » Tue May 31, 2016 11:35 pm

Thanks for confirming the approach.
Rolf
 
Posts: 28
Joined: Fri May 20, 2016 4:54 pm

Re: Nubie: primary key to span more than 1 field

Postby admin » Wed Jun 08, 2016 10:40 am

.
admin
Site Admin
 
Posts: 3348
Joined: Mon Jun 15, 2009 9:53 am


Return to General



cron