Hrm, I did not update the schema- frankly, I'd assumed that sqlite
built that out of the structure of the .db file and didn't store it
explicitly, but I didn't really think it through. Odd that it seems to
function anyway :)
Luis
On Mon, Aug 25, 2008 at 9:47 AM, Reinier Balt <[EMAIL PROTECTED]> wrote:
> Luis,
>
> Did you also update the schema of your converted db? If I run .schema on the
>
> sample sqlite database I get the following for contexts:
>
> CREATE TABLE contexts ("id" INTEGER PRIMARY KEY NOT NULL, "name"
> varchar(255) NOT NULL, "position" integer(255) DEFAULT 0, "hide" boolean
> DEFAULT 'f', "user_id" integer DEFAULT 1, "created_at" datetime DEFAULT
> NULL, "updated_at" datetime DEFAULT NULL);
>
> Note the datatype boolean for "hide"
>
> Perhaps it is wise to diff the .schema from the default database (I've
> db:migrated it a few hours ago) with your .schema to be sure...
>
> Reinier
>
>> -----Oorspronkelijk bericht-----
>> Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Luis
>> Villa
>> Verzonden: maandag 25 augustus 2008 15:25
>> Aan: BSAG
>> CC: Reinier Balt; tracks-discuss
>> Onderwerp: Re: [Tracks-discuss] bizzaro bug after upgrade, mysql-
>> >sqlite conversion
>>
>> On Mon, Aug 25, 2008 at 9:13 AM, Luis Villa <[EMAIL PROTECTED]> wrote:
>> >>> Hmm, this could be related. Admin is a Boolean in the user table.
>> Perhaps
>> >>> The booleans are not converted correctly
>> >>
>> >> I've seen these symptoms before with a conversion from MySQL to
>> sqlite3, and
>> >> in that case it was -- as Reinier suggests -- a problem with the
>> boolean
>> >> fields. MySQL uses 1/0 and sqlite3 uses t/f. Rails handles the
>> >> interpretation of the field depending on the database connection
>> type, but
>> >> if it's expecting t/f and finds 1/0, things go wrong.
>> >>
>> >> I would use the sqlite3 command line tool to explore your database
>> and check
>> >> the value of the fields:
>> >>
>> >>> cd db
>> >>> sqlite3 your-tracks-db.db
>> >>
>> >> sqlite> update contexts
>> >> ...> set hide='f'
>> >> ...> where hide=0;
>> >> ...> select * from contexts;
>> >> ...> .q
>> >>
>> >> You would do the converse and set hide='t' where hide=1 if you have
>> any
>> >> hidden contexts, along with any other boolean fields (there's 'done'
>> in
>> >> todos and couple of others, IIRC, so check the db schema.
>> >>
>> >> Then it should work OK.
>> >
>> > That's it. Thanks, BSAG!
>>
>> Note though, that when I ask sqlite to show me .schema, none of these
>> fields (context.hide, users.is_admin, some of the preferences that I
>> presume are booleans) are shown as booleans, but rather as integers-
>> so I'm sort of surprised sqlite prefers them to be t/f instead of 0/1.
>> It does seem to *work*, so I can't complain, but... that seems odd to
>> me.
>>
>> [Tangentially related: when running .schema, every table except
>> 'recurring_todos' is nicely formatted... not sure why that is.]
>>
>> Luis
>
>
_______________________________________________
Tracks-discuss mailing list
[email protected]
http://lists.rousette.org.uk/mailman/listinfo/tracks-discuss