Skip to content

fix: remove legacy type hint in models#25

Merged
frostming merged 1 commit intobamboo-cms:mainfrom
yuxiaoy1:fix/models-type-hint
Dec 28, 2023
Merged

fix: remove legacy type hint in models#25
frostming merged 1 commit intobamboo-cms:mainfrom
yuxiaoy1:fix/models-type-hint

Conversation

@yuxiaoy1
Copy link
Copy Markdown
Contributor

@frostming
Copy link
Copy Markdown
Contributor

frostming commented Dec 27, 2023

The problem of WriteOnlyMapping is cascade deletion. It can't delete the associated rows when the parent is deleted, because none is loaded. See this https://docs.sqlalchemy.org/en/20/orm/cascades.html#using-foreign-key-on-delete-cascade-with-orm-relationships.

When we need cascade deletion, the children MUST be read, making it non-write-only. Can you advice on a proper way to achieve this with WriteOnlyMapping?

I've added some cascade deletion cases, you can pull the changes and see how they fail.

@yuxiaoy1
Copy link
Copy Markdown
Contributor Author

I've made 3 updates here:

Copy link
Copy Markdown
Contributor

@frostming frostming left a comment

Choose a reason for hiding this comment

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

Thanks for that

@frostming frostming merged commit 0bd4ad8 into bamboo-cms:main Dec 28, 2023
@yuxiaoy1 yuxiaoy1 deleted the fix/models-type-hint branch December 28, 2023 10:28
180909 pushed a commit to 180909/bamboo that referenced this pull request Jan 2, 2024
frostming added a commit that referenced this pull request Mar 18, 2024
* feat: add venue and schedule_item api

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* refactor(git): ignore .idea and .vscode (#26)

* feat: improve dockerfile and docker-compose

Signed-off-by: Frost Ming <[email protected]>

* ci: add workflow to test docker (#28)

* ci: add workflow to test docker

Signed-off-by: Frost Ming <[email protected]>

* fix port

Signed-off-by: Frost Ming <[email protected]>

* copy .env

Signed-off-by: Frost Ming <[email protected]>

* wrong name

Signed-off-by: Frost Ming <[email protected]>

* use docker

Signed-off-by: Frost Ming <[email protected]>

---------

Signed-off-by: Frost Ming <[email protected]>

* fix: remove legacy type hint in models (#25)

refactor: migrate to SQLAlchemy v2

* fix test

* update schema

* update

* Update backend/bamboo/blueprints/schedule_item.py

Co-authored-by: Frost Ming <[email protected]>

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* fix pytest

---------

Signed-off-by: Frost Ming <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Yongzeng Liu <[email protected]>
Co-authored-by: Frost Ming <[email protected]>
Co-authored-by: Frost Ming <[email protected]>
Co-authored-by: Frank Yu <[email protected]>
Co-authored-by: 180909 <[email protected]>
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.

2 participants