Error after update Package.swift -->Add Leaf.git

Hello ,

I’m learning vapor swift til Chapter14 Templating with Leaf.
I have followed by the tutorial.
It can build and run the vapor project without any problem on my local pc .

Anyway, when I upload to the server and update Package.swift ,then build the project using below command on linux ubuntu server. It error like below.
I check the current swift version on the server.
It’s swift version 4.1 (swift-4.1-RELEASE).
I’m very appreciated if you could advise.

$Swift Package update
….
Updating https://github.com/vapor/fluent.git
Updating https://github.com/vapor/mysql.git
Updating https://github.com/vapor/sql.git

$ vapor build
Building Project [Failed]

/root/practice/Sources/App/Models/Acronym.swift:51:17: error: value of type ‘SchemaCreator’ has no member ‘addReference’
try builder.addReference(from: .userID, to: \User.id)

Here is the update Package.swift of the project on the server

// swift-tools-version:4.1
import PackageDescription

let package = Package(
name: “TILApp6”,
dependencies: [
.package(url: “https://github.com/vapor/vapor.git”, from: “3.0.0-rc”),
.package(url: “https://github.com/vapor/fluent-mysql.git”, from: “3.0.0-rc”),
.package(url: “https://github.com/vapor/leaf.git”, from: “3.0.0-rc”)
],
targets: [
.target(name: “App”, dependencies: [“FluentMySQL”, “Vapor”,“Leaf”]),
.target(name: “Run”, dependencies: [“App”]),
.testTarget(name: “AppTests”, dependencies: [“App”]),
]
)

Best Regards,
Thammaporn

The syntax has changed (I’m not sure if the deprecations were removed in Fluent 3.0) :thinking:

However, the new syntax is https://github.com/raywenderlich/vapor-til/blob/master/Sources/App/Models/Acronym.swift#L63

Thanks for the advice.
It solved the problem. ^^

1 Like