database: move @tables adding to defdatabase