Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infer bigint data type #893

Merged
merged 6 commits into from
Feb 14, 2021
Merged

Infer bigint data type #893

merged 6 commits into from
Feb 14, 2021

Conversation

Brobin
Copy link
Contributor

@Brobin Brobin commented Jan 28, 2021

This PR infers the data type of bigint to DataTypes.BIGINT. Previously, using just @Column on a bigint field produced this error:

Specified type of property 'id' cannot be automatically resolved to a sequelize data type. Please define the data type manually

This will lead to cleaner code as the dataType argument can be removed from @Column(DataType.BIGINT)

class Test extends Model {
  @PrimaryKey
  @AutoIncrement
-  @Column(DataType.BIGINT)
+  @Column
  id: bigint;
}

@codecov
Copy link

codecov bot commented Jan 28, 2021

Codecov Report

Merging #893 (1219705) into master (6547ffd) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #893   +/-   ##
=======================================
  Coverage   95.20%   95.20%           
=======================================
  Files         117      117           
  Lines        1126     1127    +1     
  Branches      129      129           
=======================================
+ Hits         1072     1073    +1     
  Misses         22       22           
  Partials       32       32           
Impacted Files Coverage Δ
src/sequelize/data-type/data-type-service.ts 84.61% <100.00%> (+1.28%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6547ffd...1219705. Read the comment docs.

Copy link
Collaborator

@lukashroch lukashroch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Brobin, awesome, can you please update the Type inference table in readme file?

@theoludwig theoludwig merged commit 7c467d4 into sequelize:master Feb 14, 2021
@YSHIDM
Copy link

YSHIDM commented Jun 25, 2022

I need Json, what can I do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants