I dumped a MSSQL database schema using dbicdump
:
dbicdump \
-o dump_directory=./lib \
-o components='["InflateColumn::DateTime"]' \
-o constraint='qr/(V_A_Table_With_A_Very_Long_Name)/i' \
-o preserve-case=1 \
My::Package dbi:ODBC:dsn=ODBC_Conf my_username 'secret'
The schema got generated properly, there were no error nor warning. Though, one of the column name is called Code_Tranche_Unite_Urbaine_XXXY
in the database, but what I got in the corresponding ResultSource is Code_Tranche_Unite_Urbaine_XXX
(without the Y in the end) :
package My::Schema::Result::VATableWithAVeryLongName;
#...
__PACKAGE__->table("V_A_Table_With_A_Very_Long_Name");
#...
__PACKAGE__->add_columns(
#...
# Should be 'Code_Tranche_Unite_Urbaine_XXXY'
"Code_Tranche_Unite_Urbaine_XXX",
{
accessor => "code_tranche_unite_urbaine_XXX", # No 'Y' here
data_type => "integer",
is_nullable => 1,
},
#...
);
I kept the generated ResultSource as is, didn't edited it. It looks like DBIx::Class::Schema::Loader
shorten the column name at 30 chars. This is a supposition because i didn't manage to find any documentation about it.
If it could make any difference, V_A_Table_With_A_Very_Long_Name
is a MSSQL view, accessed through ODBC.
I am a bit curious of the reasons why dbicdump
would behave this way: I could say that it is because 30 chars is really too long, but the thing is that you don't always have the possibility to change the table schema.
Is it the behavior that is expected and if so why is it like this? Could it be a bug? Is there a way to control this?
Versions: DBIx::Class::Schema::Loader
and dbicdump
comes from the same DBIx::Class::Schema::Loader
installation, 0.07049