database: table gateway foreign key support with transactions