Skip to content

Conversation

@bilby91
Copy link
Contributor

@bilby91 bilby91 commented Aug 31, 2017

Fixes #119

@codecov-io
Copy link

codecov-io commented Aug 31, 2017

Codecov Report

Merging #120 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #120      +/-   ##
==========================================
+ Coverage   96.48%   96.49%   +<.01%     
==========================================
  Files          99       99              
  Lines         911      912       +1     
  Branches      121      122       +1     
==========================================
+ Hits          879      880       +1     
  Misses         11       11              
  Partials       21       21
Impacted Files Coverage Δ
lib/models/v3/Sequelize.ts 98.18% <100%> (+0.03%) ⬆️

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 27efc23...1de8ae4. Read the comment docs.

@bilby91
Copy link
Contributor Author

bilby91 commented Aug 31, 2017

@RobinBuschmann Hey, what do you think ? I think this is the last issue that is blocking us to get this in production! A beta.2 today would be AWESOME!

export function createSequelizeValidationOnly(useModelsInPath: boolean = true): Sequelize {

return new Sequelize({
dialect: 'sqlite',
Copy link
Member

Choose a reason for hiding this comment

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

@bilby91 Whats the purpose of adding the dialectoption here?

@bilby91
Copy link
Contributor Author

bilby91 commented Aug 31, 2017

I'm not sure why it was working before. v4 requires a dialect to be explicitly defined.

@RobinBuschmann
Copy link
Member

Strange, there seem to have happened an issue earlier caused by another pull request I think.

There is a ISequelizeValidationOnlyConfig which is missing in:

export type SequelizeConfig = ISequelizeConfig | ISequelizeUriConfig | ISequelizeDbNameConfig;

When you add ISequelizeValidationOnlyConfig to SequelizeConfig it should work without dialect: 'sqlite'.

@bilby91
Copy link
Contributor Author

bilby91 commented Aug 31, 2017

@RobinBuschmann Want me to add it ?

@RobinBuschmann
Copy link
Member

RobinBuschmann commented Aug 31, 2017

It depends... does it build without dialect: 'sqlite',? Cause this line does not fit the actual api, because it is validationOnly without the need to specify database configuration.

If it is building, then we should create another pull request for this issue.

@bilby91
Copy link
Contributor Author

bilby91 commented Aug 31, 2017

@RobinBuschmann Changing this export type SequelizeConfig = ISequelizeConfig | ISequelizeUriConfig | ISequelizeDbNameConfig | ISequelizeValidationOnlyConfig; didn't fix the issue. I think the problem is different. The thing is that now the url constructor passes the options always and in v4 you need to always define the dialect. Make sense ?

@bilby91
Copy link
Contributor Author

bilby91 commented Aug 31, 2017

If we remove the dialect: 'sqlite' tests won't pass. And I think it makes sense that they don't pass without that option.

@RobinBuschmann
Copy link
Member

When validationOnly: true is defined, these options (e.g. dialect) will be added automatically: https://github.com/RobinBuschmann/sequelize-typescript/blob/master/lib/models/BaseSequelize.ts#L61

@RobinBuschmann
Copy link
Member

validationOnly: true makes it possible to use sequelize-typescript without connecting to any database. Thats why it should not be necessary to define database options.

@RobinBuschmann
Copy link
Member

Here the reason why it compiles with validationOnly: true and without dialect: https://github.com/RobinBuschmann/sequelize-typescript/blob/master/lib/models/Sequelize.d.ts#L11

@bilby91
Copy link
Contributor Author

bilby91 commented Aug 31, 2017

@RobinBuschmann Good. Got it. It was not working localy because I though npm run test was compiling the code :(.

Now it should be good to go

@RobinBuschmann RobinBuschmann merged commit 4050995 into sequelize:master Aug 31, 2017
@bilby91 bilby91 deleted the fix-constructor branch August 31, 2017 20:37
@bilby91
Copy link
Contributor Author

bilby91 commented Aug 31, 2017

Thanks for the awesome feedback loop @RobinBuschmann . Can we get a beta.2 🎉 ?

@RobinBuschmann
Copy link
Member

Thank you for fixing this :)

Its done sequelize-typescript@0.5.0-beta.2 🎉

@bilby91
Copy link
Contributor Author

bilby91 commented Aug 31, 2017

@RobinBuschmann Thanks!!

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.

3 participants