[sqlite] Dont Repeat Yourself (DRY) and SQLite

2015-11-25 Thread Bernardo Sulzbach
On Wed, Nov 25, 2015 at 1:14 PM, Simon Slavin wrote: > > CREATE TABLE use_mytype (... >... >one_type TEXT REFERENCES enum_type(theID) DEFAULT 2 > ) > > It is now harder to know which value to insert for one_type. > > Simon. > I know this works, but I would suggest using INTEGER instead

[sqlite] Dont Repeat Yourself (DRY) and SQLite

2015-11-25 Thread Domingo Alvarez Duarte
This way we repeat the string everywhere then it's not DRY ! Cheers ! > Wed Nov 25 2015 11:38:50 am CET CET from "Simon Slavin" > Subject: Re: [sqlite] Dont Repeat Yourself (DRY) and >SQLite > > On 24 Nov 2015, at 11:24pm, Domingo Alvarez Duarte > wrote:

[sqlite] Dont Repeat Yourself (DRY) and SQLite

2015-11-25 Thread Darren Duncan
I think Domingo is showing signs of cargo-culting, simply taking some mantra to the extreme without even realizing the point of the mantra. Logically speaking, enumerated values like this 'simple'/'tuple' are program identifiers in the same way as variable or field names are. These enums are

[sqlite] Dont Repeat Yourself (DRY) and SQLite

2015-11-25 Thread da...@dandymadeproductions.com
> On 25 Nov 2015, at 2:23pm, Domingo Alvarez Duarte wrote: > >> This way we repeat the string everywhere then it's not DRY ! > > You know, I think you're the first person to mention DRY here. I had to look it up. > > > > For some reason it

[sqlite] Dont Repeat Yourself (DRY) and SQLite

2015-11-25 Thread Simon Slavin
On 24 Nov 2015, at 11:24pm, Domingo Alvarez Duarte wrote: > > If we do that we'll be repeating the same string on every column and need a > string comparison, with postgres enum types or foreign keys it's an integer > and no repetition. Ah. Okay. Well SQLite implements FOREIGN KEYs

[sqlite] Dont Repeat Yourself (DRY) and SQLite

2015-11-25 Thread Domingo Alvarez Duarte
If we do that we'll be repeating the same string on every column and need a string comparison, with postgres enum types or foreign keys it's an integer and no repetition. Cheers ! > Tue Nov 24 2015 11:01:35 pm CET CET from "Simon Slavin" > Subject: Re: [sqlite] Dont Repe

[sqlite] Dont Repeat Yourself (DRY) and SQLite

2015-11-24 Thread Simon Slavin
On 24 Nov 2015, at 7:09pm, Domingo Alvarez Duarte wrote: > one_type INTEGER NOT NULL REFERENCES mytype(id) NOT NULL, --how to use > a default here ? Include "DEFAULT 'tuple'" just like you would in PostgreSQL. Otherwise I'm with Igor. I don't see why you're using TRIGGERs and I don't see

[sqlite] Dont Repeat Yourself (DRY) and SQLite

2015-11-24 Thread Domingo Alvarez Duarte
Actually we can not use "select"? on constraints ! Cheers ! > Tue Nov 24 2015 8:43:57 pm CET CET from "Igor Tandetnik" > Subject: Re: [sqlite] Dont Repeat Yourself (DRY) and >SQLite > > On 11/24/2015 2:09 PM, Domingo Alvarez Duarte wrote: > &

[sqlite] Dont Repeat Yourself (DRY) and SQLite

2015-11-24 Thread Domingo Alvarez Duarte
Hello ! I'm trying to migrate a database from PostgreSQL to SQLite but could not find a way to do it and stay DRY, is it possible to do it ? See example bellow. Cheers ! == Using literals for one_type is not an acceptable option ! one_type varchar NOT NULL DEFAULT 'tuple'

[sqlite] Dont Repeat Yourself (DRY) and SQLite

2015-11-24 Thread Darren Duncan
s or foreign keys it's an integer > and no repetition. > > Cheers ! >> Tue Nov 24 2015 11:01:35 pm CET CET from "Simon Slavin" >> Subject: Re: [sqlite] Dont Repeat Yourself (DRY) >> and >> SQLite >> >> On 24 Nov 2015, at 7:09pm, Domingo Alvar

[sqlite] Dont Repeat Yourself (DRY) and SQLite

2015-11-24 Thread Igor Tandetnik
On 11/24/2015 2:58 PM, Domingo Alvarez Duarte wrote: > Actually we can not use "select" on constraints ! And that's a problem because... ? Your triggers don't refer to any other table either. Color me dense, but I utterly fail to grasp the nature of the difficulty. -- Igor Tandetnik

[sqlite] Dont Repeat Yourself (DRY) and SQLite

2015-11-24 Thread Igor Tandetnik
On 11/24/2015 2:09 PM, Domingo Alvarez Duarte wrote: > I'm trying to migrate a database from PostgreSQL to SQLite but could not find > a way to do it and stay DRY, is it possible to do it ? SQLite supports CHECK constraints, just like Postrgress. Why do you feel you need triggers? > Using