I am using a local mysql server ver 5.1. Here my configuration file, as described in the book chapter 6 with my parameters.
import FluentMySQL
import Vapor
/// Called before your application initializes.
public func configure(_ config: inout Config, _ env: inout Environment, _ services: inout Services) throws {
/// Register providers first
try services.register(FluentMySQLProvider())
/// Register routes to the router
let router = EngineRouter.default()
try routes(router)
services.register(router, as: Router.self)
/// Register middleware
var middlewares = MiddlewareConfig() // Create _empty_ middleware config
/// middlewares.use(FileMiddleware.self) // Serves files from `Public/` directory
middlewares.use(ErrorMiddleware.self) // Catches errors and converts to HTTP response
services.register(middlewares)
/// Register the configured SQLite database to the database config.
var databases = DatabasesConfig()
let databaseConfig = MySQLDatabaseConfig(hostname: "192.168.0.5",
username: "root",
password: "admin",
database: "vapor")
let database = MySQLDatabase(config: databaseConfig)
databases.add(database: database, as: .mysql)
services.register(databases)
/// Configure migrations
var migrations = MigrationConfig()
migrations.add(model:Acronym.self, database: .mysql)
//migrations.add(model: Todo.self, database: .sqlite)
services.register(migrations)
}
I get the following error, I think its an error of migration.
Thanks,
Arnold
Thread 1: Fatal error: Error raised at top level: MySQL Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘(6) ,
updatedAt
DATETIME(6) )’ at line 1