Skip to content
Josh Wright edited this page Jan 14, 2021 · 3 revisions

Schema

Represents the schema of a table in a relational database.

public class Schema

Methods

create(table:ifNotExists:builder:)

Create a table with the supplied builder.

public func create(table: String, ifNotExists: Bool = false, builder: (inout CreateTableBuilder) -> Void)

Parameters

  • table: The name of the table to create.
  • ifNotExists: If the query should silently not be run if the table already exists. Defaults to false.
  • builder: A closure for building the new table.

alter(table:builder:)

Alter an existing table with the supplied builder.

public func alter(table: String, builder: (inout AlterTableBuilder) -> Void)

Parameters

  • table: The table to alter.
  • builder: A closure passing a builder for defining what should be altered.

drop(table:)

Drop a table.

public func drop(table: String)

Parameters

  • table: The table to drop.

rename(table:to:)

Rename a table.

public func rename(table: String, to: String)

Parameters

  • table: The table to rename.
  • to: The new name for the table.

raw(sql:)

Execute a raw SQL statement when running this migration schema.

public func raw(sql: String)

Parameters

  • sql: The raw SQL string to execute.
Alchemy
Types
Protocols
Global Typealiases
Global Variables
Global Functions
Fusion
Types
Protocols
Papyrus
Types
Protocols
Clone this wiki locally