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

Adding SQLite db to authz, updating persitence directory structure, s… #73

Merged
merged 6 commits into from
Jan 30, 2024

Conversation

mattschoch
Copy link
Contributor

…tarting to wire up crud for entities

@mattschoch mattschoch requested a review from wcalderipe January 29, 2024 22:53
prisma migrate dev \
--schema ${AUTHZ_DATABASE_SCHEMA}

authz/db/setup:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please, add the recipe under authz/setup as well so we keep the "1 command setup" working.

Comment on lines +15 to +19
model Organization {
uid String @id

@@map("organization")
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

[Not an action]

I've observed a similar situation with Orchestration and assumed we would replicate it on the node. However, I'm now questioning the necessity of the table altogether.

In the Orchestration so far, the table hasn't provided any real value. I've been utilizing an org_id column without an actual relationship, simply to enforce data tenancy. This approach revealed that when every model is dependent on Organization, it unnecessarily bloats the Organization model. As a result, by eliminating this relationship, I found that my tests needed far less setup. I no longer had to create an organization for every test, which significantly reduced the amount of boilerplate code.

While I have the Organization model, it currently serves no practical purpose.

Onboarding

If each service maintains an empty organization table, it implies that during the onboarding process, we'll need to coordinate the creation of the same organization across these services, assigning it the same ID in each instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I was actually wondering this too, especially if the Engine is single-tenant then the orgid and the table in general is not needed.

@wcalderipe
Copy link
Collaborator

You likely have to update authz_ci.yaml to set up the database.

--schema ${AUTHZ_DATABASE_SCHEMA} \
--skip-seed \
--force

authz/test/type:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Changes to the packages were breaking the implementation of the applications quite often. So, I added to the packages CIs a step to check upstream dependencies types.

Would you mind adding authz/db/generate-types before checking the types? If you run authz/test/type without the Prisma types, this test will always fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When you say adding it before checking types, you mean in the CI?

Copy link
Collaborator

@wcalderipe wcalderipe Jan 30, 2024

Choose a reason for hiding this comment

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

I meant composing both make recipes:

authz/test/type:
	make authz/db/generate-types 👈👈👈
	npx tsc \
		--project ${AUTHZ_PROJECT_DIR}/tsconfig.app.json \
		--noEmit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, done.

@mattschoch mattschoch merged commit e93bc30 into main Jan 30, 2024
2 checks passed
@wcalderipe wcalderipe deleted the feature/authz-db-setup branch March 5, 2024 14:18
mattschoch added a commit that referenced this pull request Jun 19, 2024
#73)

* Adding SQLite db to authz, updating persitence directory structure, starting to wire up crud for entities
wcalderipe added a commit that referenced this pull request Feb 5, 2025
* Add network mapping

* Refactor network type

* Remove duplicate check

* Fix network index

* Add missing DTO file
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