github.com/jbking/gohan@v0.0.0-20151217002006-b41ccf1c2a96/docs/source/database.rst (about)

     1  ==============
     2  Database
     3  ==============
     4  
     5  SQL backend
     6  --------------
     7  
     8  Gohan will geneate table based on schema.
     9  
    10  - string -> varchar(255)
    11  - integer/number -> numeric
    12  - boolean -> boolean
    13  
    14  the other column will be "text".
    15  We will encode data for json when we store complex data for db.
    16  
    17  
    18  YAML backend
    19  --------------
    20  
    21  This can be used to manipulate schema using gohan-ui.
    22  output can be used schema for gohan-server.
    23  However, YAML backend don't support constraints or concurrent
    24  request, so this backend is only for development and testing purpose.
    25  
    26  
    27  Database Conversion tool
    28  ------------------------
    29  
    30  .. code-block:: shell
    31  
    32    NAME:
    33       convert - Convert DB
    34  
    35    USAGE:
    36       command convert [command options] [arguments...]
    37  
    38    DESCRIPTION:
    39       Gohan convert can be used to migrate Gohan resources between different types of databases
    40  
    41    OPTIONS:
    42       --in-type, --it      Input db type (yaml, json, sqlite3)
    43       --in, -i             Input db connection spec (or filename)
    44       --out-type, --ot     Output db type (yaml, json, sqlite3)
    45       --out, -o            Output db connection spec (or filename)
    46       --schema, -s         Schema file
    47  
    48  
    49  Database Migraion
    50  -----------------
    51  
    52  Gohan supports generating goose (https://bitbucket.org/liamstask/goose) migration script.
    53  Currently, we don't support calcurating diff on schema, so that app developmer should manage
    54  this migration script.
    55  
    56  .. code-block:: shell
    57  
    58    NAME:
    59       migrate - Generate goose migration script
    60  
    61    USAGE:
    62       command migrate [command options] [arguments...]
    63  
    64    DESCRIPTION:
    65       Generates goose migraion script
    66  
    67    OPTIONS:
    68       --name, -n 'init_schema'		name of migrate
    69       --schema, -s 			Schema definition
    70       --path, -p 'etc/db/migrations'	Migrate path
    71       --cascade				If true, FOREIGN KEYS in database will be created with ON DELETE CASCADE
    72