# 数据库配置

kidi 内部已经集成了 sqlite,mysql,postgres 开箱即可使用

参数名称 描述 备注
type 数据库类型
url 数据库 url postgres://test:test@localhost/test
host 服务器地址
port 端口号
username 用户名
password 密码
database 数据库名称或数据库文件地址

# mysql 连接

{
    ...
    database: {
        type: "mysql",
        host: "127.0.0.1",
        port: 3306,
        user: "test",
        password: "test",
        database: "test",
        logging: true
    },
    ...
}

或者

{
    ...
    database: {
        type: "mysql",
        url:
        "mysql://user:password@host/database",
        logging: true
    },
    ...
}

# sqlite 连接

{
    ...
    "database": {
        "type": "sqlite",
        "database": "/data/something.db",
        "logging": true
        "synchronize": true,
    }
    ...
}

# postgres 连接

{
    ...
    database: {
        type: "postgres",
        url:
        "postgres://user:password@host/database",
        logging: true
    },
    ...
}