November 2018
Intermediate to advanced
404 pages
10h 16m
English
Fluent Migration provides you with convenient ways of creating a table for your model and making changes to your database's structure. The table description for your model is called a database schema. Migrations help you prepare a database schema for your model. You can also use them to make normal queries to your database.
There is a shortcut for declaring database migrations for your model. To conform Model to Migration, add an extension to conform to Migration:
extension JournalEntry: Migration {}
Fluent can infer the schema of your model automatically.
Add the following to tell Migration to create a table:
var migrations = MigrationConfig()migrations.add(model: JournalEntry.self, database: .psql)services.register(migrations) ...
Read now
Unlock full access