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

feat: model.sync add force/alter option #224

Merged
merged 4 commits into from
Nov 9, 2021

Conversation

SmartOrange
Copy link
Collaborator

@SmartOrange SmartOrange commented Nov 3, 2021

fixes #151

src/bone.js Show resolved Hide resolved
src/realm.js Outdated
if (!this.connected) await this.connect();
const { models } = this;

for (const model of Object.values(models)) {
await model.sync();
await model.sync(optins);
Copy link
Owner

Choose a reason for hiding this comment

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

s/optins/options

@cyjake
Copy link
Owner

cyjake commented Nov 3, 2021

@xudafeng this pr breaks yuque-desktop, I think it should be planned in v2 release. Perhaps 2022.1.1 is a good time?

@codecov-commenter
Copy link

codecov-commenter commented Nov 3, 2021

Codecov Report

Merging #224 (30aeeaa) into master (d947982) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #224   +/-   ##
=======================================
  Coverage   97.25%   97.25%           
=======================================
  Files          42       42           
  Lines        3096     3101    +5     
=======================================
+ Hits         3011     3016    +5     
  Misses         85       85           
Impacted Files Coverage Δ
src/bone.js 97.26% <100.00%> (+0.02%) ⬆️
src/realm.js 100.00% <100.00%> (ø)

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 d947982...30aeeaa. Read the comment docs.

@@ -135,7 +135,7 @@ describe('=> Table definitions', () => {
});
});

describe('=> Bone.sync()', () => {
describe.only('=> Bone.sync()', () => {
Copy link
Owner

Choose a reason for hiding this comment

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

only

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

🥲

@cyjake cyjake added this to the v2.0 milestone Nov 3, 2021
@cyjake cyjake merged commit e8a524a into master Nov 9, 2021
@cyjake cyjake deleted the feat-sync-options-force-or-alter branch November 9, 2021 08:06
@cyjake
Copy link
Owner

cyjake commented Nov 9, 2021

will be released at v2.x milestone

id: DataTypes.BIGINT,
name: DataTypes.STRING,
});
await realm.sync({ alter: true });
Copy link
Contributor

Choose a reason for hiding this comment

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

这个好。

cyjake pushed a commit that referenced this pull request Jan 4, 2022
* feat: model.sync add force/alter option

* fix: integration test case

* fix: typo and reminder

* fix: remove .only

Co-authored-by: mijiu.zc <mijiu.zc@alibaba-inc.com>
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.

db.sync({ force | alter })
4 participants