Skip to content

CreateColumnBuilder

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

CreateColumnBuilder

A builder for creating columns on a table in a relational database.

public final class CreateColumnBuilder<Default: Sequelizable>: ColumnBuilderErased

Default is a Swift type that can be used to add a default value to this column.

Inheritance

ColumnBuilderErased

Methods

`default`(expression:)

Adds an expression as the default value of this column.

@discardableResult public func `default`(expression: String) -> Self

Parameters

  • expression: An expression for generating the default value of this column.

Returns

This column builder.

`default`(val:)

Adds a value as the default for this column.

@discardableResult public func `default`(val: Default) -> Self

Parameters

  • expression: A default value for this column.

Returns

This column builder.

notNull()

Define this column as not nullable.

@discardableResult public func notNull() -> Self

Returns

This column builder.

references(_:on:)

Defines this column as a reference to another column on a table.

@discardableResult public func references(_ column: String, on table: String) -> Self

Parameters

  • column: The column name this column references.
  • table: The table of the column this column references.

Returns

This column builder.

primary()

Defines this column as a primary key.

@discardableResult public func primary() -> Self

Returns

This column builder.

unique()

Defines this column as unique.

@discardableResult public func unique() -> Self

Returns

This column builder.

Alchemy
Types
Protocols
Global Typealiases
Global Variables
Global Functions
Fusion
Types
Protocols
Papyrus
Types
Protocols
Clone this wiki locally