[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MySQL/MariaDB Boolean Type
From: |
Nala Ginrut |
Subject: |
Re: MySQL/MariaDB Boolean Type |
Date: |
Mon, 13 Mar 2023 01:23:18 +0800 |
User-agent: |
mu4e 1.4.15; emacs 27.1 |
Hi Jaft!
I actually fixed several bugs in models and migrations in recent
months. Maybe you should try vanilla now.
Best regards.
Jaft writes:
> Mmm; then maybe there's an issue just with migrations? When I tried using
> "boolean" for creating a table in a migration, I got an error in
> "->mysql-type"; checking that function out, I did notice that there's no case
> for "boolean".
> On Friday, March 10, 2023 at 01:07:48 PM CST, Nala Ginrut <mulei@gnu.org>
> wrote:
>
>
> Sorry, I misunderstood you.
> You were asking why I provide it.
> Actually, for mysql/mariadb, Artanis won't do anything for boolean, it's
> only for sqlite3. So it won't cause any problem.
>
> Best regards.
>
>
> Nala Ginrut writes:
>
>> Hi Jaft!
>> Aratnis had abstracted boolean type in mvc/model.scm
>> --------------------code----------------
>> (define *db-specific-types*
>> '((mysql
>> (text . longtext)
>> (boolean . boolean))
>> (postgresql
>> (text . text)
>> (boolean . boolean))
>> (sqlite3
>> (text . text)
>> (boolean . integer))))
>> ---------------------end-----------------
>>
>>
>>
>> You may use `boolean' to define a table in a model, for example:
>>
>> -----------------code---------------
>> (create-table
>> 'user
>> '(id auto (#:primary-key))
>> '(name char-field (#:not-null #:maxlen 128))
>> '(is_admin boolean (#:not-null))
>> '(last_login bigint (#:unsigned #:not-null)))
>> ------------------end------------------
>>
>> I'm sorry I haven't put it in the document, I'll introduce it in the
>> recent release.
>>
>> Best regards.
>>
>>
>>
>> Jaft writes:
>>
>>> I think I always meant to ask but keep forgetting to – what wouldyou think,
>>> Nala, of providing a boolean type?
>>> Both MySQL and MariaDB abstract this type for the user, already, so
>>> doingthe same at the Artanis layer wouldn't be terribly different than the
>>> DB converting boolean values to 1 and 0, right?
>>> And it'd make working with those values easier to read when reading the
>>> code of a project, for the first time.
--
GNU Powered it
GPL Protected it
GOD Blessed it
HFG - NalaGinrut
Fingerprint F53B 4C56 95B5 E4D5 6093 4324 8469 6772 846A 0058
signature.asc
Description: PGP signature