You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Schema Loader version 0.07049
Database: postgresql/jammy 14+238
OS: Linux ubuntu-jammy 5.15.0-25-generic
Example script: See below
Table schema: See below
Issue: repeated warnings that the perhaps I " forgot to set its 'is_auto_increment' attribute during add_columns()?"
But Schema Loader doesn't recognise uuid_generate_v4() as setting the primary key when analysing existing table
How do I get Schema Loader to recognise that there is a default value for the primary key?
Example warning:
DBIx::Class::Storage::DBI::insert(): Missing value for primary key column 'id' on POSTGRES_TABLE - perhaps you forgot to set its 'is_auto_increment' attribute during add_columns()? Treating 'id' implicitly as an autoinc, and attempting value retrieval at PERL_CODE_LINE
Postgres Schema for Table "Invoice"
Table "public.invoice"
Column | Type | Collation | Nullable | Default
----------+-----------------------------+-----------+----------+--------------------
id | uuid | | not null | uuid_generate_v4()
created | timestamp without time zone | | not null | now()
modified | timestamp without time zone | | not null | now()
amount | money | | not null |
currency | character varying(3) | | not null |
is_paid | boolean | | not null | false
user_id | integer | | not null |
Indexes:
"invoice_pkey" PRIMARY KEY, btree (id)
"invoice_unique_id" UNIQUE CONSTRAINT, btree (id)
Calling script (functional part).
use DBIx::Class::Schema::Loader qw/ make_schema_at /;
make_schema_at(
'Series::Schema',
{ components => ["InflateColumn::DateTime"],
debug => 0,
dump_directory => './lib',
moniker_map => \&moniker,
},
[ $sql_db->{db_dsn}, $sql_db->{db_username}, $sql_db->{db_password}, {} ],
);
sub moniker {
my $table = shift;
my $result;
if ( $table eq 'user_table' ) {
$result = 'User';
}
elsif ( $table eq 'group_table' ) {
$result = 'Group';
}
else {
$result = join q{}, map {ucfirst} split /_/, $table;
}
return $result;
} ## end sub moniker
The text was updated successfully, but these errors were encountered:
Migrated from rt.cpan.org#143291 (status was 'new')
Requestors:
From bruins@hal9000.net.au on 2022-06-14 10:40:43
:
The text was updated successfully, but these errors were encountered: