Skip Menu |
 

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 111159
Status: rejected
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: rrwo [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



MIME-Version: 1.0
X-Spam-Status: No, score=-2.6 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham
X-Spam-Flag: NO
content-type: text/plain; charset="utf-8"
Message-ID: <56968E11.9090500 [...] cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Sasl-Enc: yGfWDrtNG8U7Cxb3NHiZNyWpnFjy8mfqvnOrJiLZguee 1452707346
X-Spam-Score: -2.6
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 839F9240344 for <cpan-bug+DBIx-Class [...] hipster.bestpractical.com>; Wed, 13 Jan 2016 12:49:16 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jER9IgIkVV+9 for <cpan-bug+DBIx-Class [...] hipster.bestpractical.com>; Wed, 13 Jan 2016 12:49:15 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 0FEF424025E for <bug-DBIx-Class [...] rt.cpan.org>; Wed, 13 Jan 2016 12:49:14 -0500 (EST)
Received: (qmail 6725 invoked by alias); 13 Jan 2016 17:49:14 -0000
Received: from out3-smtp.messagingengine.com (HELO out3-smtp.messagingengine.com) (66.111.4.27) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Wed, 13 Jan 2016 09:49:10 -0800
Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id AD39021ACF for <bug-DBIx-Class [...] rt.cpan.org>; Wed, 13 Jan 2016 12:49:06 -0500 (EST)
Received: from frontend1 ([10.202.2.160]) by compute6.internal (MEProxy); Wed, 13 Jan 2016 12:49:06 -0500
Received: from [172.16.2.167] (5ec26859.skybroadband.com [94.194.104.89]) by mail.messagingengine.com (Postfix) with ESMTPA id 4E699C016DB for <bug-DBIx-Class [...] rt.cpan.org>; Wed, 13 Jan 2016 12:49:06 -0500 (EST)
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] messagingengine.com
Delivered-To: cpan-bug+DBIx-Class [...] hipster.bestpractical.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0
Subject: [WISHLIST] Use Type::Tiny types for specifying columns
Return-Path: <rrwo [...] cpan.org>
X-RT-Mail-Extension: dbix-class
X-Original-To: cpan-bug+DBIx-Class [...] hipster.bestpractical.com
X-Spam-Check-BY: la.mx.develooper.com
Dkim-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=SmX5I7S2q0ElYLNoJ56z2s/e238=; b=uuG58 y/xPBC3RCEDydM6QMR+CraJzJ6FoYKOZTAWzF/0IG5BPTWyv+KG57LwVKgajERF7 mp+I1jAT6yu2KF7QMOBW3LnwiCVPjfmy4aXwuOE3sexvpzs0oSkAUdIiav1B29mg 6LtFzIwVu+pLTVdaigTxd5GurhLkAMuV78yxqg=
Date: Wed, 13 Jan 2016 17:49:05 +0000
X-Spam-Level:
X-Enigmail-Draft-Status: N1110
To: bug-DBIx-Class [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Robert Rothenberg <rrwo [...] cpan.org>
X-RT-Original-Encoding: utf-8
X-RT-Interface: Email
Content-Length: 544
Download (untitled) / with headers
text/plain 544b
It would be nice to be able to do something like __PACKAGE__->add_column( foo => Maybe[ Varchar[16] ] ); or __PACKAGE__->add_column( foo => { isa => Maybe[ Varchar[16] ], extra => { ... } } ); This is actually not hard to do. I have some (prototype) code in the Types::SQL distribution that does this. It makes the code easier to read, especially for developers who are already using Moo/Moose for other parts of the code. (And object attributes that depend on database columns can be given the same types.)
MIME-Version: 1.0
X-Spam-Status: No, score=-5.506 tagged_above=-99.9 required=10 tests=[AWL=0.394, BAYES_00=-1.9, FROM_OUR_RT=-4] autolearn=ham
In-Reply-To: <rt-4.0.18-911-1452707357-454.111159-4-0 [...] rt.cpan.org>
X-Spam-Flag: NO
X-RT-Interface: API
References: <RT-Ticket-111159 [...] rt.cpan.org> <56968E11.9090500 [...] cpan.org> <rt-4.0.18-911-1452707357-454.111159-4-0 [...] rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Message-ID: <56969150.5040507 [...] cpan.org>
content-type: text/plain; charset="utf-8"; format="flowed"
X-RT-Original-Encoding: utf-8
X-Spam-Score: -5.506
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 794EF240372 for <cpan-bug+DBIx-Class [...] hipster.bestpractical.com>; Wed, 13 Jan 2016 13:03:20 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aIffpl+ij3pw for <cpan-bug+DBIx-Class [...] hipster.bestpractical.com>; Wed, 13 Jan 2016 13:03:18 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 9CA7124025E for <bug-DBIx-Class [...] rt.cpan.org>; Wed, 13 Jan 2016 13:03:18 -0500 (EST)
Received: (qmail 7538 invoked by alias); 13 Jan 2016 18:03:18 -0000
Received: from mujunyku.leporine.io (HELO mujunyku.leporine.io) (113.212.96.195) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Wed, 13 Jan 2016 10:03:06 -0800
Received: from [10.0.13.10] (unknown [10.0.13.10]) by mujunyku.leporine.io (Postfix) with ESMTP id 1F8BEF461A for <bug-DBIx-Class [...] rt.cpan.org>; Wed, 13 Jan 2016 18:02:59 +0000 (UTC)
Delivered-To: cpan-bug+DBIx-Class [...] hipster.bestpractical.com
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0
Subject: Re: [rt.cpan.org #111159] [WISHLIST] Use Type::Tiny types for specifying columns
Return-Path: <ribasushi [...] cpan.org>
X-Spam-Check-BY: la.mx.develooper.com
X-Original-To: cpan-bug+DBIx-Class [...] hipster.bestpractical.com
X-RT-Mail-Extension: dbix-class
Date: Wed, 13 Jan 2016 19:02:56 +0100
X-Spam-Level:
To: bug-DBIx-Class [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Peter Rabbitson <ribasushi [...] cpan.org>
RT-Message-ID: <rt-4.0.18-30285-1452708201-587.111159-0-0 [...] rt.cpan.org>
Content-Length: 1742
Download (untitled) / with headers
text/plain 1.7k
On 01/13/2016 06:49 PM, Robert Rothenberg via RT wrote: Show quoted text
> Wed Jan 13 12:49:17 2016: Request 111159 was acted upon. > Transaction: Ticket created by RRWO > Queue: DBIx-Class > Subject: [WISHLIST] Use Type::Tiny types for specifying columns > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: rrwo@cpan.org > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=111159 > > > > It would be nice to be able to do something like > > __PACKAGE__->add_column( foo => Maybe[ Varchar[16] ] ); > > or > > __PACKAGE__->add_column( > foo => { > isa => Maybe[ Varchar[16] ], > extra => { ... } > } > ); > > This is actually not hard to do. I have some (prototype) code in the > Types::SQL distribution that does this. > > It makes the code easier to read, especially for developers who are already > using Moo/Moose for other parts of the code. (And object attributes that > depend on database columns can be given the same types.) >
I have not looked at Types::SQL, so what follows is just a general observation. To stop the tendency of DBIC itself is becoming overly-monolithic, the general direction of such enhancements these days is to push them out of the core distrubution, and have them as standalone extra-sugar, akin to DBIx::Class::Candy. Is there a reason this can not be done in the same manner for the above (or even as a subset of ::Candy-like syntax)? Note - I have not thought through the entire proposal as there is little code to go with it (and Types::SQL does things "in the other direction" so it's hard to reason about it from there). So please elaborate more / point out what am I missing. Show quoted text
> > > >
MIME-Version: 1.0
X-Spam-Status: No, score=-6.6 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FROM_OUR_RT=-4, RCVD_IN_DNSWL_LOW=-0.7] autolearn=ham
In-Reply-To: <rt-4.0.18-30285-1452708202-300.111159-6-0 [...] rt.cpan.org>
X-Spam-Flag: NO
X-RT-Interface: API
References: <RT-Ticket-111159 [...] rt.cpan.org> <56968E11.9090500 [...] cpan.org> <rt-4.0.18-911-1452707357-454.111159-4-0 [...] rt.cpan.org> <56969150.5040507 [...] cpan.org> <rt-4.0.18-30285-1452708202-300.111159-6-0 [...] rt.cpan.org>
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Message-ID: <5697940C.5030708 [...] cpan.org>
content-type: text/plain; charset="utf-8"
X-Sasl-Enc: uaHGKF00La9RTk9+rQxbN5z95ZzR4lDG0swlcTi4c8Yq 1452774413
X-RT-Original-Encoding: utf-8
X-Spam-Score: -6.6
Authentication-Results: hipster.bestpractical.com (amavisd-new); dkim=pass header.i= [...] messagingengine.com
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id E506524022B for <cpan-bug+DBIx-Class [...] hipster.bestpractical.com>; Thu, 14 Jan 2016 07:27:03 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KrqRpRhQAOrj for <cpan-bug+DBIx-Class [...] hipster.bestpractical.com>; Thu, 14 Jan 2016 07:27:01 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 9B183240078 for <bug-DBIx-Class [...] rt.cpan.org>; Thu, 14 Jan 2016 07:27:01 -0500 (EST)
Received: (qmail 22029 invoked by alias); 14 Jan 2016 12:27:00 -0000
Received: from out3-smtp.messagingengine.com (HELO out3-smtp.messagingengine.com) (66.111.4.27) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Thu, 14 Jan 2016 04:26:58 -0800
Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 0391A20869 for <bug-DBIx-Class [...] rt.cpan.org>; Thu, 14 Jan 2016 07:26:54 -0500 (EST)
Received: from frontend1 ([10.202.2.160]) by compute3.internal (MEProxy); Thu, 14 Jan 2016 07:26:54 -0500
Received: from [172.16.2.167] (97e2a9a7.skybroadband.com [151.226.169.167]) by mail.messagingengine.com (Postfix) with ESMTPA id 9D6E0C016D5 for <bug-DBIx-Class [...] rt.cpan.org>; Thu, 14 Jan 2016 07:26:53 -0500 (EST)
Delivered-To: cpan-bug+DBIx-Class [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #111159] [WISHLIST] Use Type::Tiny types for specifying columns
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.4.0
Return-Path: <rrwo [...] cpan.org>
Dkim-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-sasl-enc:x-sasl-enc; s=smtpout; bh=QMADBIAFgf8irqp pfyeLhWq65Vo=; b=sI46y/eM38y9iVeyhB8MYSYnnAuvf2R+Ibzt5BpkPl0RRE/ oREKBUSX5rLHdetcTPFyOSFdmCKm1FUchILeaJ5qgjXUgauH4q2+LkUl2CTDFQFa gVQUvAoWYE5ayf95nZUUCA8sUN1cHGh5nypyKy1kuAHzdE1axKWJiH67MVPg=
X-Spam-Check-BY: la.mx.develooper.com
X-Original-To: cpan-bug+DBIx-Class [...] hipster.bestpractical.com
X-RT-Mail-Extension: dbix-class
Date: Thu, 14 Jan 2016 12:26:52 +0000
X-Spam-Level:
X-Enigmail-Draft-Status: N1110
To: bug-DBIx-Class [...] rt.cpan.org
Content-Transfer-Encoding: 7bit
From: Robert Rothenberg <rrwo [...] cpan.org>
RT-Message-ID: <rt-4.0.18-4328-1452774424-281.111159-0-0 [...] rt.cpan.org>
Content-Length: 2689
Download (untitled) / with headers
text/plain 2.6k
On 13/01/16 18:03, Peter Rabbitson via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=111159 > > > On 01/13/2016 06:49 PM, Robert Rothenberg via RT wrote:
>> Wed Jan 13 12:49:17 2016: Request 111159 was acted upon. >> Transaction: Ticket created by RRWO >> Queue: DBIx-Class >> Subject: [WISHLIST] Use Type::Tiny types for specifying columns >> Broken in: (no value) >> Severity: (no value) >> Owner: Nobody >> Requestors: rrwo@cpan.org >> Status: new >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=111159 > >> >> >> It would be nice to be able to do something like >> >> __PACKAGE__->add_column( foo => Maybe[ Varchar[16] ] ); >> >> or >> >> __PACKAGE__->add_column( >> foo => { >> isa => Maybe[ Varchar[16] ], >> extra => { ... } >> } >> ); >> >> This is actually not hard to do. I have some (prototype) code in the >> Types::SQL distribution that does this. >> >> It makes the code easier to read, especially for developers who are already >> using Moo/Moose for other parts of the code. (And object attributes that >> depend on database columns can be given the same types.) >>
> > I have not looked at Types::SQL, so what follows is just a general > observation. > > To stop the tendency of DBIC itself is becoming overly-monolithic, the > general direction of such enhancements these days is to push them out of > the core distrubution, and have them as standalone extra-sugar, akin to > DBIx::Class::Candy. Is there a reason this can not be done in the same > manner for the above (or even as a subset of ::Candy-like syntax)?
Fair point. I've also been in touch w/author of DBIC::Candy as well about the idea. Show quoted text
> Note - I have not thought through the entire proposal as there is little > code to go with it (and Types::SQL does things "in the other direction" > so it's hard to reason about it from there). So please elaborate more / > point out what am I missing.
Well, given a type like Maybe[Varchar[16]] we can extract the info for the column definition: data_type => 'varchar', is_nullable => 1, size => 16 The code in Types::SQL::Util https://github.com/robrwo/Types-SQL/blob/master/lib/Types/SQL/Util.pm has a function to generate the column information from Type::Tiny objects (not just Types::SQL but also Str, Enum, Int). Something like use Types::SQL::Util; ... # Where $info is the column_info if ((blessed $info) && $info->isa('Type::Tiny')) { $info = { isa => $info }; } if (my $type = $info->{isa}) { my %t_info = column_info_from_type( $type ); $info->{$_} //= $t_info{$_} for keys %t_info; }
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-4328-1452774424-281.111159-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <RT-Ticket-111159 [...] rt.cpan.org> <56968E11.9090500 [...] cpan.org> <rt-4.0.18-911-1452707357-454.111159-4-0 [...] rt.cpan.org> <56969150.5040507 [...] cpan.org> <rt-4.0.18-30285-1452708202-300.111159-6-0 [...] rt.cpan.org> <5697940C.5030708 [...] cpan.org> <rt-4.0.18-4328-1452774424-281.111159-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-1775-1453460369-831.111159-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 1487
Download (untitled) / with headers
text/plain 1.4k
On Thu Jan 14 13:27:04 2016, RRWO wrote: Show quoted text
> > Well, given a type like Maybe[Varchar[16]] we can extract the info for > the > column definition: > > data_type => 'varchar', > is_nullable => 1, > size => 16
I looked more into this, and think it is a pretty bad idea as far as usability is concerned. Users should not care about 'Varchar' at all (in fact it is looked down upon in the Pg world now[1]). What users care about is "I need to store that many ascii or unicode characters. Similarly Users only care about "at least being able to fit uint_24" without really caring if the underlying storage is unsigned, or is exactly 3 bytes long. The point I am trying to make is that Types::SQL is decidedly abstracting at the wrong level. Currently the mangling of "varchar" into something the target DDL will find palatable is done by SQL::Translator with a really terrible mapping between each and every producer. Something like Types::SQL is supposed to make this easier on an architectural level (with a proper hierarchy of types, proper dialects (e.g. Varchar => Text) etc), instead of just adding minimal sugar. Thus the module is not suitable for further DBIC integration even as an external optional component. Furthermore I'd recommend DBIx::Class::Candy avoiding integration as well. We can do much better. I am closing this ticket in the queue, and am bringing it to the attention of the ::Candy maint. Cheers! [1] http://blog.jonanin.com/2013/11/20/postgresql-char-varchar/


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.