Berry
Berry

Reputation: 2308

Additional Data types (such as Unsigned SmallInt, Datetime and Decimal) in Swift Vapor/Fluent Model?

I'm trying to create a Model with Vapor, and in the prepare method, I can't seem to figure out how to add some data types into the statement.

Looking into the Vapor source code, there seems to be some data types that can be stored:

extension Schema {
    /**
        Various types of fields
        that can be used in a Schema.
    */
    public struct Field {
        public var name: String
        public var type: DataType
        public var optional: Bool

        public enum DataType {
            case id
            case int
            case string(length: Int?)
            case double
            case bool
            case data
        }

        public init(name: String, type: DataType, optional: Bool = false) {
            self.name = name
            self.type = type
            self.optional = optional
        }
    }
}

So Data Types like Int, String (VARCHAR), Double, Bool and Data (BLOB) can be stored, but I can't find the ones I'm looking for, specifically:

How would I make these?

Upvotes: 1

Views: 481

Answers (1)

Berry
Berry

Reputation: 2308

At the moment, the feature is not present in Vapor / Fluent, however it's in the making.

Here's the issues page of Vapor regarding DATETIME

Upvotes: 0

Related Questions