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): support postgres schema. #3348

Closed
wants to merge 9 commits into from
Closed

Conversation

appleboy
Copy link
Member

fix #2755

create new database and start the gitea.

e_base", "has_merged", "merged_commit_id", "merger_id", "merged_unix" FROM "pull_request" WHERE status = $1 []interface {}{1}
2018/01/11 15:10:55 [.../runtime/asm_amd64.s:2337 goexit()] [E] ArchiveClean: pq: relation "repository" does not exist
2018/01/11 15:10:55 [.../runtime/asm_amd64.s:2337 goexit()] [E] DeletedBranchesCleanup: pq: relation "deleted_branch" does not exist
2018/01/11 15:10:55 [I] [SQL] SELECT repo.id FROM "repository" repo WHERE repo.num_stars!=(SELECT COUNT(*) FROM "star" WHERE repo_id=repo.id)
2018/01/11 15:10:55 [I] [SQL] SELECT label.id FROM "label" WHERE label.num_issues!=(SELECT COUNT(*) FROM "issue_label" WHERE label_id=label.id)
2018/01/11 15:10:55 [...gitea/models/repo.go:2259 CheckRepoStats()] [E] Select repository count 'num_stars': pq: relation "repository" does not exist
2018/01/11 15:10:55 [.../runtime/asm_amd64.s:2337 goexit()] [E] DeliverHooks: pq: relation "hook_task" does not exist
2018/01/11 15:10:55 [I] [SQL] SELECT "user".id FROM "user" WHERE "user".num_repos!=(SELECT COUNT(*) FROM "repository" WHERE owner_id="user".id)
2018/01/11 15:10:55 [...gitea/models/repo.go:2259 CheckRepoStats()] [E] Select label count 'num_issues': pq: relation "label" does not exist
2018/01/11 15:10:55 [...gitea/models/repo.go:2259 CheckRepoStats()] [E] Select user count 'num_repos': pq: relation "user" does not exist
2018/01/11 15:10:55 [I] [SQL] SELECT "issue".id FROM "issue" WHERE "issue".num_comments!=(SELECT COUNT(*) FROM "comment" WHERE issue_id="issue".id AND type=0)
2018/01/11 15:10:55 [I] [SQL] SELECT repo.id FROM "repository" repo WHERE repo.num_closed_issues!=(SELECT COUNT(*) FROM "issue" WHERE repo_id=repo.id AND is_closed=$1AND is_pull=$2) []interface {}{true, false}
2018/01/11 15:10:55 [...gitea/models/repo.go:2259 CheckRepoStats()] [E] Select issue count 'num_comments': pq: relation "issue" does not exist
2018/01/11 15:10:55 [.../runtime/asm_amd64.s:2337 goexit()] [E] Select repository count 'num_closed_issues': pq: relation "repository" does not exist
2018/01/11 15:10:55 [I] [SQL] SELECT repo.id FROM "repository" repo WHERE repo.num_forks!=(SELECT COUNT(*) FROM "repository" WHERE fork_id=repo.id)
2018/01/11 15:10:55 [.../runtime/asm_amd64.s:2337 goexit()] [E] Select repository count 'num_forks': pq: relation "repository" does not exist
2018/01/11 15:10:55 [...gitea/models/pull.go:1161 TestPullRequests()] [E] Find Checking PRs%!(EXTRA *pq.Error=pq: relation "pull_request" does not exist)
2018/01/11 15:10:55 Serving [::]:3000 with pid 24634
2018/01/11 15:10:55 [I] Listen: http://0.0.0.0:3000

need @lunny help but it is working for public schema.

@codecov-io
Copy link

codecov-io commented Jan 11, 2018

Codecov Report

Merging #3348 into master will increase coverage by 14.76%.
The diff coverage is 22.72%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master    #3348       +/-   ##
===========================================
+ Coverage   20.27%   35.04%   +14.76%     
===========================================
  Files         146      280      +134     
  Lines       29320    40593    +11273     
===========================================
+ Hits         5945    14224     +8279     
- Misses      22474    24263     +1789     
- Partials      901     2106     +1205
Impacted Files Coverage Δ
models/models.go 47.2% <22.72%> (+18.32%) ⬆️
modules/markup/html.go 54.56% <0%> (-25.2%) ⬇️
routers/api/v1/repo/hook.go 0% <0%> (-19.12%) ⬇️
models/issue_user.go 65.71% <0%> (-6.29%) ⬇️
models/issue_milestone.go 57.8% <0%> (-1.77%) ⬇️
routers/repo/issue_label.go 45.92% <0%> (-1.18%) ⬇️
models/org.go 67.88% <0%> (-0.35%) ⬇️
routers/user/auth_openid.go 0% <0%> (ø) ⬆️
routers/api/v1/repo/issue_tracked_time.go 0% <0%> (ø) ⬆️
models/issue_stopwatch.go 75% <0%> (ø) ⬆️
... and 239 more

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 1546458...9a46778. Read the comment docs.

@tboerger tboerger added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jan 11, 2018
@appleboy appleboy requested a review from lunny January 11, 2018 07:44
@lunny lunny added the pr/wip This PR is not ready for review label Jan 11, 2018
@lunny lunny added this to the 1.x.x milestone Jan 11, 2018
@lunny lunny added the type/enhancement An improvement of existing functionality label Jan 11, 2018
@appleboy appleboy changed the title feat(model): support postgres schema. [WIP] feat(model): support postgres schema. Jan 11, 2018
@appleboy
Copy link
Member Author

appleboy commented May 1, 2018

update status:

Try the latest version of Gitea source code with update the latest xorm version and get the following error message:

WHERE c.relkind = 'r'::char AND c.relname = $1 AND s.table_schema = $2 AND f.attnum > 0 ORDER BY f.attnum; [oauth2_session public]
2018/05/01 09:04:02 [I] [SQL] SELECT indexname, indexdef FROM pg_indexes WHERE tablename=$1 AND schemaname=$2 [oauth2_session public]
2018/05/01 09:04:02 [I] [SQL] CREATE TABLE IF NOT EXISTS "oauth2_session" ("id" VARCHAR(400) PRIMARY KEY NOT NULL, "data" TEXT NULL, "created_unix" BIGINT NULL, "updated_unix" BIGINT NULL, "expires_unix" BIGINT NULL)
2018/05/01 09:04:02 [I] [SQL] CREATE INDEX "IDX_oauth2_session_expires_unix" ON "oauth2_session" ("expires_unix")
2018/05/01 09:04:02 [...itea/routers/init.go:64 GlobalInit()] [E] Failed to initialize OAuth2 support: pq: relation "IDX_oauth2_session_expires_unix" already exists

screen shot 2018-04-30 at 8 58 29 am

cc @lunny

@appleboy appleboy force-pushed the pg branch 2 times, most recently from 22ee94f to 6d5db5a Compare May 1, 2018 01:07
@appleboy
Copy link
Member Author

appleboy commented May 1, 2018

build errors:

  1. https://drone.gitea.io/go-gitea/gitea/316/8
  2. https://drone.gitea.io/go-gitea/gitea/316/10 (integration testing with postgres)

@appleboy appleboy changed the title [WIP] feat(model): support postgres schema. feat(model): support postgres schema. May 3, 2018
@appleboy appleboy removed the pr/wip This PR is not ready for review label May 3, 2018
@appleboy
Copy link
Member Author

appleboy commented May 3, 2018

@lunny Done. This PR can be review now.

@appleboy appleboy modified the milestones: 1.x.x, 1.5.0 May 3, 2018
@appleboy appleboy added type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/enhancement An improvement of existing functionality and removed type/enhancement An improvement of existing functionality type/feature Completely new functionality. Can only be merged if feature freeze is not active. labels May 3, 2018
@lunny
Copy link
Member

lunny commented May 3, 2018

But CI failed. @appleboy it seems related.

@lunny
Copy link
Member

lunny commented May 4, 2018

appleboy added 2 commits May 14, 2018 15:34
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
models/repo.go Outdated
Join("INNER", "user", "user.id = repository.owner_id").
Where("repository.lower_name = ?", strings.ToLower(repoName)).
And("user.lower_name = ?", strings.ToLower(ownerName)).
Join("INNER", "user", "`user`.id = repository.owner_id").
Copy link
Member

Choose a reason for hiding this comment

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

Do you mean &User{} here?

@lafriks lafriks modified the milestones: 1.5.0, 1.6.0 May 15, 2018
@techknowlogick techknowlogick modified the milestones: 1.6.0, 1.7.0 Aug 28, 2018
@techknowlogick techknowlogick modified the milestones: 1.7.0, 1.8.0 Dec 19, 2018
@techknowlogick
Copy link
Member

@appleboy please resolve conflict

@techknowlogick techknowlogick modified the milestones: 1.8.0, 1.9.0 Feb 19, 2019
@stale
Copy link

stale bot commented Apr 20, 2019

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you for your contributions.

@stale stale bot added the issue/stale label Apr 20, 2019
@lunny lunny added the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label Apr 21, 2019
@stale stale bot removed the issue/stale label Apr 21, 2019
@techknowlogick techknowlogick modified the milestones: 1.9.0, 1.10.0 Jun 4, 2019
@lkraider
Copy link

lkraider commented Jul 3, 2019

Can this be reviewed for merge? Using schemas makes the management of multiple DBs easier.

@techknowlogick
Copy link
Member

@lkraider conflicts need to be resolved first

@techknowlogick techknowlogick modified the milestones: 1.10.0, 1.11.0 Sep 3, 2019
@lunny
Copy link
Member

lunny commented Nov 16, 2019

Please resolve the conflicts.

@lunny lunny modified the milestones: 1.11.0, 1.12.0 Dec 13, 2019
@sapk
Copy link
Member

sapk commented Dec 20, 2019

It seems that this PR will be superseded by #8819

@lunny lunny closed this Dec 20, 2019
@lunny lunny removed this from the 1.12.0 milestone Dec 20, 2019
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Indices trying to be created second time
8 participants