fukamachi / mito

An ORM for Common Lisp with migrations, relationships and PostgreSQL support
284 stars 31 forks source link

Adding documentation for :col-type #108

Closed daninus14 closed 3 years ago

daninus14 commented 3 years ago

Please make sure this is correct, I got the keywords from https://github.com/fukamachi/mito/blob/master/src/core/class/column.lisp (defgeneric table-column-info ...)

Thanks!

fukamachi commented 3 years ago

Thank you for your contribution!

It's probably better to explain some about it, though it's hard to list because it depends on what RDS (and version) to connect to. For instance, :json and :jsonb are also allowed in PostgreSQL, but old MySQL doesn't support those types.

daninus14 commented 3 years ago

Hi, what I wrote was based on the link above, and that file doesn't have a :json or :jsonb. I just searched the whole repo for :json and for :jsonb and nothing showed up. Is there a place where all the valid keywords are defined?

fukamachi commented 3 years ago

To begin with, there is no restriction on the value that can go into that field. Just as you can write a CREATE TABLE with columns of any type, Mito will create a CREATE TABLE statement based on the col-type written. But it's a different matter whether the type will be accepted by RDBMS.

This behavior can't be avoided in that each RDBMS supports different types, and that types can be added freely by plug-ins (like PostgreSQL can even write geometry types by PostGIS).

Therefore, it is impossible to list all available types. However, it may help someone to list the frequent types as you have written.

daninus14 commented 3 years ago

Ok, updated it, and added links to RDBMS specific data types. See the latest commit. Had minor update for github markdown format.

fukamachi commented 3 years ago

Many thanks!