hasura-camelize
hasura-camelize copied to clipboard
Prefix table with source when db is not the default
Prefixing the table with the source name when the db is not the default
avoids naming conflicts. i.e. if both databases have a table named
orders
Thanks for contributing!
I'm not sure if this should really be the default behavior though, people may have non-default source without wanting the tables renamed in that way. The same behavior can easily be achieved by:
import convert from 'hasura-camelize';
const source = 'custom';
convert(
{
...,
source
},
{
transformTableNames(
name,
defaultTransformer
) {
return defaultTransformer(`${source}_${name}`);
};
}
);
Or maybe I didn't fully understand the intend. In that case, could you elaborate a bit more?