-
-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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
[Multi-Database Support][postgre] add postgre sql and docs #4782
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4782 +/- ##
============================================
+ Coverage 47.26% 47.29% +0.03%
+ Complexity 1661 1660 -1
============================================
Files 346 346
Lines 10683 10683
Branches 1063 1063
============================================
+ Hits 5049 5053 +4
+ Misses 5327 5322 -5
- Partials 307 308 +1 see 5 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
/* # CREATE apolloconfigdb; */ | ||
/* # ------------------------------------------------------------ */ | ||
|
||
CREATE DATABASE "ApolloPortalDB"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like Postgres is very different from MySQL, which would make future contributions harder.
I'm thinking how about we abstract a storage layer this time and move the Postgres support to a new git repository, e.g. apollo-storage-extensions? The apollo-storage-extensions repository would target a specific version of apollo and doesn't have to be updated every time a feature is added. It would instead be updated by some Postgres user from time to time when they think is necessary.
cc @apolloconfig/committers what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I humbly suggest that we create a separate folder for now, as we are not entirely clear on which boundaries should be placed between multiple databases in the main code and extensions. My recommendation is that we start by placing PostgreSQL and other databases in a separate folder. Once we have successfully achieved compatibility with one or two databases, we can then begin to separate the repository.
cc @apolloconfig/committers
@@ -248,3 +248,118 @@ Apollo Config Demo. Please input key to get the value. Input quit to exit. | |||
app.id=你的appId | |||
``` | |||
运行`./demo.sh client`启动Demo客户端即可。 | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the default database for quick start?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nobodyiam I think it will be mysql, since we haven't finish h2 feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If mysql is the default, then section 5.2 is not necessary?
41c65a9
to
7d2227a
Compare
I'm not familiar with postgre but when I tried to import the sql files, some errors occurred:
|
docs/zh/deployment/quick-start.md
Outdated
|-------------|---------|-------|--------------------| | ||
| 1 | timeout | 100 | sample timeout配置 | | ||
|
||
## 5.3 配置其他数据库连接信息 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to list detailed instructions to guide the users on how the change the demo.sh, e.g. how to change the spring_profiles_group_github
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nobodyiam PTAL again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the instructions to enable postgre, so it's better to merge it to 5.1
52a1d7f
to
0703020
Compare
docs/zh/deployment/quick-start.md
Outdated
|-------------|---------|-------|--------------------| | ||
| 1 | timeout | 100 | sample timeout配置 | | ||
|
||
## 5.3 配置其他数据库连接信息 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the instructions to enable postgre, so it's better to merge it to 5.1
docs/zh/deployment/quick-start.md
Outdated
|
||
``` | ||
|
||
## 5.4 配置mysql数据库连接信息 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the instructions to enable mysql, so it's better to merge it to 5.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nobodyiam fixed
BTW, apollo could start with pg now, but the following errors occurred when I tried to log in.
|
Co-authored-by: Jason Song <nobodyiam@gmail.com>
Co-authored-by: Jason Song <nobodyiam@gmail.com>
8b7b28e
to
18d4eb6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like the pg sql is quite different from the mysql one, maybe it's better to put it in another repository for easier maintanance, e.g. apollo-storage-postgre
VALUES ('apollo', 'ROLE_user'); | ||
|
||
-- spring session (https://github.com/spring-projects/spring-session/blob/main/spring-session-jdbc/src/main/resources/org/springframework/session/jdbc/schema-postgresql.sql) | ||
CREATE TABLE apolloportal.SPRING_SESSION |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it better to quote the table name just like we did for other tables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's copied from spring-session repo. I suggest we not change this. And spring-session connect to lower-case table.
CREATE INDEX SPRING_SESSION_IX2 ON apolloportal.SPRING_SESSION (EXPIRY_TIME); | ||
CREATE INDEX SPRING_SESSION_IX3 ON apolloportal.SPRING_SESSION (PRINCIPAL_NAME); | ||
|
||
CREATE TABLE apolloportal.SPRING_SESSION_ATTRIBUTES |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it better to quote the table name just like we did for other tables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's copied from spring-session repo. I suggest we not change this. And spring-session connect to lower-case table.
Co-authored-by: Jason Song <nobodyiam@gmail.com>
Are we considering put these jpa sql in one repo. Like apollo-storage-rds? |
Yes, I'm seriously considering creating a new repo to host schema/codes for different storages. |
This pull request has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in 14 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
This pull request has been automatically closed because it has not had activity in the last 14 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Brief changelog
Add postgre sql and docs
Follow this checklist to help us incorporate your contribution quickly and easily:
mvn clean test
to make sure this pull request doesn't break anything.CHANGES
log.