Hey everyone,
I've got this schema definition:
Schema.define({
name: 'Addresses',
fields: [
{ name: 'address_id', type: 'int', autoIncrement: true, defaultValue: 1 },
{ name: 'address_street', type: 'varchar', size: 100 },
{ name: 'address_unit', type: 'varchar', size: 100 },
{ name: 'address_city', type: 'varchar', size: 100 },
{ name: 'address_code', type: 'varchar', size: 20 },
{ name: 'address_country_id', type: 'int' },
{ name: 'address_region_id', type: 'int' }
],
primaryKey: 'address_id'
});
Then, in a *.sjs file, I am executing the following:
var address = {};
address = Schema.newRecord('Addresses');
console.dir(address);
Which creates this output:
(object) :
[address_id] : (number) 1
[address_street] : (string) (empty)
[address_unit] : (string) (empty)
[address_city] : (string) (empty)
[address_code] : (string) (empty)
[address_country_id] : (number) 0
[address_region_id] : (number) 0
Problem is, that there are 2 rows of data in the table already, so I thought the newRecord method should return an object with address_id == 3.
Obviously, continuing with an existing address_id is kinda messing things up.
What am I missing?
Thanks,
Eric