mirror of https://github.com/vapor/docs.git
Added `any` qualifier to code examples on Migrations page (#1083)
Swift 5.6 added the `any` keyword as an existential type qualifier. This PR updates the code examples on the Migrations page to correctly incorporate this keyword. The following languages are effected: EN, ES, NL, IT, and ZH.
This commit is contained in:
parent
d6eb192bd8
commit
2336e613dc
|
|
@ -5,11 +5,11 @@ Las migraciones son una especie de control de versiones para tu base de datos. C
|
||||||
```swift
|
```swift
|
||||||
// Una migración de ejemplo.
|
// Una migración de ejemplo.
|
||||||
struct MyMigration: Migration {
|
struct MyMigration: Migration {
|
||||||
func prepare(on database: Database) -> EventLoopFuture<Void> {
|
func prepare(on database: any Database) -> EventLoopFuture<Void> {
|
||||||
// Haz un cambio en la base de datos.
|
// Haz un cambio en la base de datos.
|
||||||
}
|
}
|
||||||
|
|
||||||
func revert(on database: Database) -> EventLoopFuture<Void> {
|
func revert(on database: any Database) -> EventLoopFuture<Void> {
|
||||||
// Deshaz el cambio hecho en `prepare`, si es posible.
|
// Deshaz el cambio hecho en `prepare`, si es posible.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -19,11 +19,11 @@ Si estás usando `async`/`await` deberías implementar el protocolo `AsyncMigrat
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
struct MyMigration: AsyncMigration {
|
struct MyMigration: AsyncMigration {
|
||||||
func prepare(on database: Database) async throws {
|
func prepare(on database: any Database) async throws {
|
||||||
// Haz un cambio en la base de datos.
|
// Haz un cambio en la base de datos.
|
||||||
}
|
}
|
||||||
|
|
||||||
func revert(on database: Database) async throws {
|
func revert(on database: any Database) async throws {
|
||||||
// Deshaz el cambio hecho en `prepare`, si es posible.
|
// Deshaz el cambio hecho en `prepare`, si es posible.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,11 @@ Le migrazioni sono come un sistema di controllo versione per il tuo database. Og
|
||||||
```swift
|
```swift
|
||||||
// Un esempio di migrazione.
|
// Un esempio di migrazione.
|
||||||
struct MyMigration: Migration {
|
struct MyMigration: Migration {
|
||||||
func prepare(on database: Database) -> EventLoopFuture<Void> {
|
func prepare(on database: any Database) -> EventLoopFuture<Void> {
|
||||||
// Fai una modifica al database.
|
// Fai una modifica al database.
|
||||||
}
|
}
|
||||||
|
|
||||||
func revert(on database: Database) -> EventLoopFuture<Void> {
|
func revert(on database: any Database) -> EventLoopFuture<Void> {
|
||||||
// Disfai le modifiche fatte in `prepare`, se possibile.
|
// Disfai le modifiche fatte in `prepare`, se possibile.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -19,11 +19,11 @@ Se usi `async`/`await` devi implementare il protocollo `AsyncMigration`:
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
struct MyMigration: AsyncMigration {
|
struct MyMigration: AsyncMigration {
|
||||||
func prepare(on database: Database) async throws {
|
func prepare(on database: any Database) async throws {
|
||||||
// Fai una modifica al database.
|
// Fai una modifica al database.
|
||||||
}
|
}
|
||||||
|
|
||||||
func revert(on database: Database) async throws {
|
func revert(on database: any Database) async throws {
|
||||||
// Disfai le modifiche fatte in `prepare`, se possibile.
|
// Disfai le modifiche fatte in `prepare`, se possibile.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,11 @@ Migrations are like a version control system for your database. Each migration d
|
||||||
```swift
|
```swift
|
||||||
// An example migration.
|
// An example migration.
|
||||||
struct MyMigration: Migration {
|
struct MyMigration: Migration {
|
||||||
func prepare(on database: Database) -> EventLoopFuture<Void> {
|
func prepare(on database: any Database) -> EventLoopFuture<Void> {
|
||||||
// Make a change to the database.
|
// Make a change to the database.
|
||||||
}
|
}
|
||||||
|
|
||||||
func revert(on database: Database) -> EventLoopFuture<Void> {
|
func revert(on database: any Database) -> EventLoopFuture<Void> {
|
||||||
// Undo the change made in `prepare`, if possible.
|
// Undo the change made in `prepare`, if possible.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -19,11 +19,11 @@ If you're using `async`/`await` you should implement the `AsyncMigration` protoc
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
struct MyMigration: AsyncMigration {
|
struct MyMigration: AsyncMigration {
|
||||||
func prepare(on database: Database) async throws {
|
func prepare(on database: any Database) async throws {
|
||||||
// Make a change to the database.
|
// Make a change to the database.
|
||||||
}
|
}
|
||||||
|
|
||||||
func revert(on database: Database) async throws {
|
func revert(on database: any Database) async throws {
|
||||||
// Undo the change made in `prepare`, if possible.
|
// Undo the change made in `prepare`, if possible.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,11 @@ Migraties zijn als een versiebeheersysteem voor uw database. Elke migratie defin
|
||||||
```swift
|
```swift
|
||||||
// Een voorbeeld migratie.
|
// Een voorbeeld migratie.
|
||||||
struct MyMigration: Migration {
|
struct MyMigration: Migration {
|
||||||
func prepare(on database: Database) -> EventLoopFuture<Void> {
|
func prepare(on database: any Database) -> EventLoopFuture<Void> {
|
||||||
// Breng een wijziging aan in de database.
|
// Breng een wijziging aan in de database.
|
||||||
}
|
}
|
||||||
|
|
||||||
func revert(on database: Database) -> EventLoopFuture<Void> {
|
func revert(on database: any Database) -> EventLoopFuture<Void> {
|
||||||
// Maak de verandering in `prepare` ongedaan, indien mogelijk.
|
// Maak de verandering in `prepare` ongedaan, indien mogelijk.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -19,11 +19,11 @@ Als je `async`/`await` gebruikt moet je het `AsyncMigration` protocol implemente
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
struct MyMigration: AsyncMigration {
|
struct MyMigration: AsyncMigration {
|
||||||
func prepare(on database: Database) async throws {
|
func prepare(on database: any Database) async throws {
|
||||||
// Breng een wijziging aan in de database.
|
// Breng een wijziging aan in de database.
|
||||||
}
|
}
|
||||||
|
|
||||||
func revert(on database: Database) async throws {
|
func revert(on database: any Database) async throws {
|
||||||
// Maak de verandering in `prepare` ongedaan, indien mogelijk.
|
// Maak de verandering in `prepare` ongedaan, indien mogelijk.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,11 +5,11 @@
|
||||||
```swift
|
```swift
|
||||||
// An example migration.
|
// An example migration.
|
||||||
struct MyMigration: Migration {
|
struct MyMigration: Migration {
|
||||||
func prepare(on database: Database) -> EventLoopFuture<Void> {
|
func prepare(on database: any Database) -> EventLoopFuture<Void> {
|
||||||
// Make a change to the database.
|
// Make a change to the database.
|
||||||
}
|
}
|
||||||
|
|
||||||
func revert(on database: Database) -> EventLoopFuture<Void> {
|
func revert(on database: any Database) -> EventLoopFuture<Void> {
|
||||||
// Undo the change made in `prepare`, if possible.
|
// Undo the change made in `prepare`, if possible.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -19,11 +19,11 @@ struct MyMigration: Migration {
|
||||||
|
|
||||||
```swift
|
```swift
|
||||||
struct MyMigration: AsyncMigration {
|
struct MyMigration: AsyncMigration {
|
||||||
func prepare(on database: Database) async throws {
|
func prepare(on database: any Database) async throws {
|
||||||
// Make a change to the database.
|
// Make a change to the database.
|
||||||
}
|
}
|
||||||
|
|
||||||
func revert(on database: Database) async throws {
|
func revert(on database: any Database) async throws {
|
||||||
// Undo the change made in `prepare`, if possible.
|
// Undo the change made in `prepare`, if possible.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue