Fortune MySQL Adapter
This is a MySQL adapter for Fortune; forked from the Postgres adapter as suggested in Fortune Issue 103.
DO NOT USE YET. Most functionality is broken due to differences between Postgres and MySQL. This includes:
- auto-generation of schema
- Column datatypes, defintions, etc.
- CRUD
- relationships
- other differences yet to be discovered by testing
Usage
Install the fortune-mysql
package from npm
:
$ npm install fortune-mysql
Then use it with Fortune (db must be already available):
const fortune = const mysqlAdapter = const store =
Options
url
: Connection URL string. Required if no other connection options are given. Add the query paramssl=true
to enable SSL.connection
: Connection object, see documentation. This takes precendence over the URL. Optional.pool
: an instance of a pool can be passed in directly. This takes precendence over all connection settings. Optional.typeMap
: an object keyed by type name and valued by table name.primaryKeyType
: Data type of the primary key. May beString
,Number
, or a string for custom type. Default:String
.generatePrimaryKey
: A function that accepts one argument, thetype
of the record, and returns either aString
orNumber
. By default, it returns 15 random bytes, base64 encoded in a URI-safe way. Set this to a falsey value likenull
to turn this off.useForeignKeys
: Whether or not to use foreign key constraint, optional since it will only be applied to non-array fields. Default:false
.
For further options and internal usage, refer to the Postgres adapter.
License
This software is licensed under the MIT License.