Domain Documentation

Class Comments

public final class Comments: Model  

Representation of Comments table

Comments Comments Model Model Comments->Model

Conforms To

Model

Initializers

init()

public init()  

init(id:​body:​author:​article:​created​At:​updated​At:​)

public init( id: Int? = nil, body: String, author: Int, article: Int, createdAt: Date? = nil, updatedAt: Date? = nil )  

Default initializer

Parameters

id Int?

See id.

body String

See body.

author Int

See author.

article Int

See article.

created​At Date?

See createdAt.

updated​At Date?

See updatedAt.

Properties

schema

public static let schema = "Comments"

id

@ID(custom: .id, generatedBy: .database)
    public var id: Int? 

A Identifier.

It is assumed that the value is entered on the Database side. The application does not change this value usually.

body

@Field(key: "body")
    public var body: String

A body.

author

@Parent(key: "author")
    public var author: Users

A author. It's a Users's id.

article

@Parent(key: "article")
    public var article: Articles

A article. It's a Articles's id.

created​At

@Field(key: "createdAt")
    public var createdAt: Date? 

A created date.

It is assumed that the value is entered on the Database side. The application does not change this value usually.

updated​At

@Field(key: "updatedAt")
    public var updatedAt: Date? 

A updated date.

It is assumed that the value is entered on the Database side. The application does not change this value usually.

Methods

create(on:​)

public static func create(on database: MySQLDatabase) -> EventLoopFuture<Void>  

Execute SQL statement for table creation.

In general, you should use features provided by the following standards: https://docs.vapor.codes/3.0/fluent/models/#create

Parameters

connection

A established connection.