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

Implemented Postgres #2147

Draft
wants to merge 5 commits into
base: dev
Choose a base branch
from
Draft

Implemented Postgres #2147

wants to merge 5 commits into from

Conversation

BigHoss
Copy link

@BigHoss BigHoss commented Oct 14, 2024

I implemented postgres as a database backend.
Unfortunately, the setup process does not work with rdbms systems as the order of created entities will not allow it to.

For example:
A site is inserted, but the layouts which ids it points to are not yet.

@TheHadiAhmadi
Copy link
Contributor

TheHadiAhmadi commented Oct 15, 2024

@BigHoss Thank you for opening PR.

It would be great if you open separate PRs for slnx and Docker changes. and only add Postgres db in this PR.

#2150
#2151

I've opened Issues for slnx and docker.

@pournasserian will review the PR

@BigHoss
Copy link
Author

BigHoss commented Oct 15, 2024

Will do

@pournasserian
Copy link
Contributor

@BigHoss Thanks for the PR.

We are not allowed to change any Entity if there are some requirements, limitations, or concerns regarding a specific database engine.

If the object model design needs some enhancement, please open an issue/PR and explain there. Then, we will review and update it.

Each PR should apply changes to a related area to its own issue. As @TheHadiAhmadi said, we some other issues and PRs, then we should review this PR.

BTW, I will keep this PR open, and that would be great if your continue collaborating in the code, I appreciate that.

Thanks

@pournasserian
Copy link
Contributor

@BigHoss I have another idea (not sure if feasible): is it possible to develop a single repository using EF and have multiple configurations to support SQL Server, MySQL, Posgres, SQLite, etc.?

@BigHoss
Copy link
Author

BigHoss commented Oct 17, 2024

So in general, i created this pr to discuss the setup process.

So the postgres implementation does not work yet as the order of initialized entities will kot work in any relational database.

About seperating the changes, i am working on that.

And i tried to keep the impact to the entities as minimal as possible (shadow properties in the db config instead of adding pk props to entities)

Yes, this can be the foundation for other rdbms. But as the migrations are implementation specific (differnt datatypes that are db specific) and the migration is used to setup the db at startup we will need to seperate and recreate those per db system. But the this can be handled in the configuratiok, so the DbContext can be used for all as the config happens on it initialization.

@pournasserian
Copy link
Contributor

@BigHoss Is it a "MUST" to implement model first EF?

We can create a setup SQL script to create DB schema. Then, we should have different scripts for each DB engines. The EF repository codes will be the same.

What do you think?

@BigHoss
Copy link
Author

BigHoss commented Oct 18, 2024

It's not really a must, but taking care of all the manual db code, as it should be idempotent, is just a hell of a job. (and no automatic refactorings → changing a name in the model has to be done manually in all the sqls).

So having multiple projects with their respective migrations and having one script to generate these seems like an easier job than to make sure that each time you change smth, you have to manually implement it everywhere.

let me first finish this implementation. Then it is quite easy to have a demo implementation for another rdbms, to see this in action

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