Hi, I know you have used foreign keys Ivan, and I am wondering if you or anyone else could straighten its use out for me.
This is a ficticious example (the actual fields are not real for this example), but lets say I wanted this new database which is created during plug-in install, to always mirror my users file (i.e. same number of records, idential ID's for each user). Assuming when you add or delete a record from the users table, this table would automatically be affect also. Is this syntax correct? Would someone mind confirming that the action is oneway i.e. only changes to the master table (Users in this case) will affect the other table, and not the other way around???
ID => { pos => 1, type => 'INT', not_null => 1, regex => '^\d+$' },
Announcements => { pos => 2, type => 'CHAR', size => '255', not_null => 0, default=> 'None.' },
blah blah
Username => { pos => 7, blah blah blah }
);
$c2->pk('ID'); <<Do I still need to specify the primary key when using an fk?
$c2->ai('ID');
$c2->fk ( {
'Users' =>
{ ID => ID,
...
LinkOwner => LinksOwner
}
}
);
if (! $c2->create()) {
$GT::SQL::errcode ||= '';
$GT::SQL::errcode eq blah blah blah
$c2->set_defaults();
$c2->save_schema();
};
I apologise for the untidy formatting, cut and paste is behaving strangely
http://www.iuni.com/...tware/web/index.html
Links Plugins
This is a ficticious example (the actual fields are not real for this example), but lets say I wanted this new database which is created during plug-in install, to always mirror my users file (i.e. same number of records, idential ID's for each user). Assuming when you add or delete a record from the users table, this table would automatically be affect also. Is this syntax correct? Would someone mind confirming that the action is oneway i.e. only changes to the master table (Users in this case) will affect the other table, and not the other way around???

Code:
$c2->cols ( ID => { pos => 1, type => 'INT', not_null => 1, regex => '^\d+$' },
Announcements => { pos => 2, type => 'CHAR', size => '255', not_null => 0, default=> 'None.' },
blah blah
Username => { pos => 7, blah blah blah }
);
$c2->pk('ID'); <<Do I still need to specify the primary key when using an fk?
$c2->ai('ID');
$c2->fk ( {
'Users' =>
{ ID => ID,
...
LinkOwner => LinksOwner
}
}
);
if (! $c2->create()) {
$GT::SQL::errcode ||= '';
$GT::SQL::errcode eq blah blah blah
$c2->set_defaults();
$c2->save_schema();
};
I apologise for the untidy formatting, cut and paste is behaving strangely

http://www.iuni.com/...tware/web/index.html
Links Plugins