diff --git a/GRDB/QueryInterface/Schema/TableDefinition.swift b/GRDB/QueryInterface/Schema/TableDefinition.swift index f61d2faae4..80e7abd38e 100644 --- a/GRDB/QueryInterface/Schema/TableDefinition.swift +++ b/GRDB/QueryInterface/Schema/TableDefinition.swift @@ -691,7 +691,7 @@ public final class TableAlteration { /// Renames a column in a table. /// /// try db.alter(table: "player") { t in - /// t.rename(column: "url", to: "home_url") + /// t.rename(column: "url", to: "homeURL") /// } /// /// See https://www.sqlite.org/lang_altertable.html @@ -705,7 +705,7 @@ public final class TableAlteration { /// Renames a column in a table. /// /// try db.alter(table: "player") { t in - /// t.rename(column: "url", to: "home_url") + /// t.rename(column: "url", to: "homeURL") /// } /// /// See https://www.sqlite.org/lang_altertable.html diff --git a/README.md b/README.md index db2eddc146..d51b194a45 100644 --- a/README.md +++ b/README.md @@ -3911,15 +3911,17 @@ Other **table constraints** can involve several columns: ### Modify Tables -SQLite lets you rename tables, and add columns to existing tables: +SQLite lets you modify existing tables: ```swift // ALTER TABLE referer RENAME TO referrer try db.rename(table: "referer", to: "referrer") -// ALTER TABLE player ADD COLUMN url TEXT +// ALTER TABLE player ADD COLUMN hasBonus BOOLEAN +// ALTER TABLE player RENAME COLUMN url TO homeURL try db.alter(table: "player") { t in - t.add(column: "url", .text) + t.add(column: "hasBonus", .boolean) + t.rename(column: "url", to: "homeURL") // SQLite 3.25+ } ```