github.com/mmatczuk/gohan@v0.0.0-20170206152520-30e45d9bdb69/docs/database.md (about) 1 # Database 2 3 ## SQL backend 4 5 Gohan generates SQL table definition based on a schema. 6 7 - string -> varchar(255) 8 - integer/number -> numeric 9 - boolean -> boolean 10 11 the other column will be "text". 12 We will encode data for JSON when we store complex data for RDBMS. 13 14 15 ## YAML backend 16 17 YAML backend supports persistent data in YAML file format, and this backend is for only development purpose. 18 19 ## Database Conversion tool 20 21 You can convert data source each other using convert tool. 22 23 ``` 24 NAME: 25 convert - Convert DB 26 27 USAGE: 28 command convert [command options] [arguments...] 29 30 DESCRIPTION: 31 Gohan convert can be used to migrate Gohan resources between different types of databases 32 33 OPTIONS: 34 --in-type, --it Input db type (yaml, json, sqlite3) 35 --in, -i Input db connection spec (or filename) 36 --out-type, --ot Output db type (yaml, json, sqlite3) 37 --out, -o Output db connection spec (or filename) 38 --schema, -s Schema file 39 ``` 40 41 ## Database Migration 42 43 Gohan supports generating goose (https://bitbucket.org/liamstask/goose) migration script. 44 Currently, Gohan doesn't provide function calculating diff on a schema, so that app developers should manage this migration script. 45 46 ``` 47 48 NAME: 49 migrate - Generate goose migration script 50 51 USAGE: 52 command migrate [command options] [arguments...] 53 54 DESCRIPTION: 55 Generates goose migration script 56 57 OPTIONS: 58 --name, -n 'init_schema' name of migrate 59 --schema, -s Schema definition 60 --path, -p 'etc/db/migrations' Migrate path 61 --cascade If true, FOREIGN KEYS in database will be created with ON DELETE CASCADE 62 ``` 63