Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ Design type | Sequelize data type
`string` | `STRING`
`boolean` | `BOOLEAN`
`number` | `INTEGER`
`bigint` | `BIGINT`
`Date` | `DATE`
`Buffer` | `BLOB`

Expand Down
2 changes: 2 additions & 0 deletions src/sequelize/data-type/data-type-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ export function inferDataType(designType: any): DataTypeAbstract | undefined {
switch (designType) {
case String:
return DataTypes.STRING;
case BigInt:
return DataTypes.BIGINT;
case Number:
return DataTypes.INTEGER;
case Boolean:
Expand Down
18 changes: 17 additions & 1 deletion test/specs/table_column.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {expect, use} from 'chai';
import * as chaiAsPromised from 'chai-as-promised';
import {ModelAttributes} from 'sequelize';
import {Model, Table, Column, DataType} from "../../src";
import {Model, Table, Column, DataType, AutoIncrement, PrimaryKey} from "../../src";
import {createSequelize} from "../utils/sequelize";
import {User} from "../models/User";
import {getOptions} from "../../src/model/shared/model-service";
Expand Down Expand Up @@ -197,6 +197,22 @@ describe('table_column', () => {

describe('column', () => {

it('should infer the correct data type for bigint', () => {
@Table
class BigIntModel extends Model {
@PrimaryKey
@AutoIncrement
@Column
id: bigint;
}

sequelize.addModels([BigIntModel]);

const attributes = getAttributes(BigIntModel.prototype);

expect(attributes.id.type).to.equal(DataType.BIGINT);
});

it('should create appropriate sql query', () => {

const seq = createSequelize(false);
Expand Down