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ACzB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,YAAY,EAAE,IAAI,CAAC,YAAY;YAC/B,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YAC3C,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,kBAAkB,EAAE,IAAI,CAAC,kBAAkB;YAC3C,IAAI,EAAE,IAAI,CAAC,IAAI;SAClB,CAAC,CAAC;IACP,CAAC;IAEL,kBAAC;AAAD,CAzMA,AAyMC,IAAA","file":"TableColumn.js","sourcesContent":["import {TableColumnOptions} from \"../options/TableColumnOptions\";\n\n/**\n * Table's columns in the database represented in this class.\n */\nexport class TableColumn {\n\n    // -------------------------------------------------------------------------\n    // Public Properties\n    // -------------------------------------------------------------------------\n\n    /**\n     * Column name.\n     */\n    name: string;\n\n    /**\n     * Column type.\n     */\n    type: string;\n\n    /**\n     * Column's default value.\n     */\n    default?: any;\n\n    /**\n     * ON UPDATE trigger. Works only for MySQL.\n     */\n    onUpdate?: string;\n\n    /**\n     * Indicates if column is NULL, or is NOT NULL in the database.\n     */\n    isNullable: boolean = false;\n\n    /**\n     * Indicates if column is auto-generated sequence.\n     */\n    isGenerated: boolean = false;\n\n    /**\n     * Specifies generation strategy if this column will use auto increment.\n     * `rowid` option supported only in CockroachDB.\n     */\n    generationStrategy?: \"uuid\"|\"increment\"|\"rowid\";\n\n    /**\n     * Indicates if column is a primary key.\n     */\n    isPrimary: boolean = false;\n\n    /**\n     * Indicates if column has unique value.\n     */\n    isUnique: boolean = false;\n\n    /**\n     * Indicates if column stores array.\n     */\n    isArray: boolean = false;\n\n    /**\n     * Column's comment.\n     */\n    comment?: string;\n\n    /**\n     * Column type's length. Used only on some column types.\n     * For example type = \"string\" and length = \"100\" means that ORM will create a column with type varchar(100).\n     */\n    length: string = \"\";\n\n    /**\n     * Column type's display width. Used only on some column types in MySQL.\n     * For example, INT(4) specifies an INT with a display width of four digits.\n     */\n    width?: number;\n\n    /**\n     * Defines column character set.\n     */\n    charset?: string;\n\n    /**\n     * Defines column collation.\n     */\n    collation?: string;\n\n    /**\n     * The precision for a decimal (exact numeric) column (applies only for decimal column), which is the maximum\n     * number of digits that are stored for the values.\n     */\n    precision?: number|null;\n\n    /**\n     * The scale for a decimal (exact numeric) column (applies only for decimal column), which represents the number\n     * of digits to the right of the decimal point and must not be greater than precision.\n     */\n    scale?: number;\n\n    /**\n     * Puts ZEROFILL attribute on to numeric column. Works only for MySQL.\n     * If you specify ZEROFILL for a numeric column, MySQL automatically adds the UNSIGNED attribute to the column\n     */\n    zerofill: boolean = false;\n\n    /**\n     * Puts UNSIGNED attribute on to numeric column. Works only for MySQL.\n     */\n    unsigned: boolean = false;\n\n    /**\n     * Array of possible enumerated values.\n     */\n    enum?: string[];\n\n    /**\n     * Generated column expression. Supports only in MySQL.\n     */\n    asExpression?: string;\n\n    /**\n     * Generated column type. Supports only in MySQL.\n     */\n    generatedType?: \"VIRTUAL\"|\"STORED\";\n\n    /**\n     * Spatial Feature Type (Geometry, Point, Polygon, etc.)\n     */\n    spatialFeatureType?: string;\n\n    /**\n     * SRID (Spatial Reference ID (EPSG code))\n     */\n    srid?: number;\n\n    // -------------------------------------------------------------------------\n    // Constructor\n    // -------------------------------------------------------------------------\n\n    constructor(options?: TableColumnOptions) {\n        if (options) {\n            this.name = options.name;\n            this.type = options.type || \"\";\n            this.length = options.length || \"\";\n            this.width = options.width;\n            this.charset = options.charset;\n            this.collation = options.collation;\n            this.precision = options.precision;\n            this.scale = options.scale;\n            this.zerofill = options.zerofill || false;\n            this.unsigned = this.zerofill ? true : (options.unsigned || false);\n            this.default = options.default;\n            this.onUpdate = options.onUpdate;\n            this.isNullable = options.isNullable || false;\n            this.isGenerated = options.isGenerated || false;\n            this.generationStrategy = options.generationStrategy;\n            this.isPrimary = options.isPrimary || false;\n            this.isUnique = options.isUnique || false;\n            this.isArray = options.isArray || false;\n            this.comment = options.comment;\n            this.enum = options.enum;\n            this.asExpression = options.asExpression;\n            this.generatedType = options.generatedType;\n            this.spatialFeatureType = options.spatialFeatureType;\n            this.srid = options.srid;\n        }\n    }\n\n    // -------------------------------------------------------------------------\n    // Public Methods\n    // -------------------------------------------------------------------------\n\n    /**\n     * Clones this column to a new column with exact same properties as this column has.\n     */\n    clone(): TableColumn {\n        return new TableColumn(<TableColumnOptions>{\n            name: this.name,\n            type: this.type,\n            length: this.length,\n            width: this.width,\n            charset: this.charset,\n            collation: this.collation,\n            precision: this.precision,\n            scale: this.scale,\n            zerofill: this.zerofill,\n            unsigned: this.unsigned,\n            enum: this.enum,\n            asExpression: this.asExpression,\n            generatedType: this.generatedType,\n            default: this.default,\n            onUpdate: this.onUpdate,\n            isNullable: this.isNullable,\n            isGenerated: this.isGenerated,\n            generationStrategy: this.generationStrategy,\n            isPrimary: this.isPrimary,\n            isUnique: this.isUnique,\n            isArray: this.isArray,\n            comment: this.comment,\n            spatialFeatureType: this.spatialFeatureType,\n            srid: this.srid\n        });\n    }\n\n}\n"],"sourceRoot":"../.."}