Skip to content

A package for updating from Vapor 1 to Vapor 2

Notifications You must be signed in to change notification settings

vapor-community/migrator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

45 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vapor 1 -> 2 Migrator

This package can help you migrate your Vapor 1.x project to Vapor 2.0. It includes method stubs with deprecation warnings for Vapor 1 API that has changed or been removed.

1. Add Migrator to your Package.swift

Add .Package(url: "https://github.com/vapor/migrator.git", majorVersion: 1) to your Package.swift dependencies. Your file should look something like this ...

import PackageDescription

let package = Package(
    name: "Project",
    dependencies: [
        ...
        .Package(url: "https://github.com/vapor/migrator.git", majorVersion: 1)
    ],
    exclude: [ ... ]
)

2. Update Dependencies

Update your project with vapor update

Make sure to follow the prompts to regenerate your Xcode project, if you don't regenerate, it will not work.

3. Import Migrator

Migrator should only be included temporarily, so pick any file in your project, and add this import to the top.

@_exported import Migrator

4. Build Your Project

Build your project with cmd + b or cmd + r if you're using an executable. This may fail, but will help Xcode with autocomplete.

5. Update Your Project

You should see a lot of deprecations, go through and use them to help you when you're updating your project.

6. Remove Migrator

Once you've used migrator to help you update your project, you should remove migrator from your Package.swift file, remove the @_exported import Migrator and run vapor update again. DO NOT USE MIGRATOR IN PRODUCTION PROJECTS

7. Enjoy Vapor 2

Enjoy Vapor 2, it's leaner, faster, and streamlined in just about every way, check out more of the full release notes.

Vapor 2.0.0 release notes for more information.