# Postgres initialization fails, schema not found

**URL:** <https://forum.gitea.com/t/postgres-initialization-fails-schema-not-found/3192>\
**Category:** Install/Maintain/Configure\
**Created:** [April 17, 2021, 1:46pm UTC](https://forum.gitea.com/t/postgres-initialization-fails-schema-not-found/3192 "2021-04-17T13:46:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jforman](https://avatars.discourse-cdn.com/v4/letter/j/f0a364/32.png) [@jforman](https://forum.gitea.com/u/jforman)\
**Post date:** [April 17, 2021, 1:46pm UTC](https://forum.gitea.com/t/postgres-initialization-fails-schema-not-found/3192/1 "2021-04-17T13:46:15Z")

</div>

I’m trying to use the gitea helm chart to install gitea using an external postgres DB, but the install seems to fail about a schema not found.

My helm values.yaml  
gitea:  
config:  
APP\_NAME: “Gitea: git.foo.dev”  
database:  
DB\_TYPE: postgres  
HOST: db1.foo.dev:5432  
NAME: gitea  
USER: gitea  
PASSWD: myrandompassword  
SCHEMA: gitea  
database:  
builtIn:  
postgresql:  
enabled: false

But when I try to install the chart, the gitea container fails:

- gitea migrate  
2021/04/17 13:24:57 …dules/setting/git.go:91:newGit() [I] Git Version: 2.26.3, Wire Protocol Version 2 Enabled  
2021/04/17 13:24:57 cmd/migrate.go:31:runMigrate() [T] AppPath: /usr/local/bin/gitea  
2021/04/17 13:24:57 cmd/migrate.go:32:runMigrate() [T] AppWorkPath: /usr/local/bin  
2021/04/17 13:24:57 cmd/migrate.go:33:runMigrate() [T] Custom path: /data/gitea  
2021/04/17 13:24:57 cmd/migrate.go:34:runMigrate() [T] Log path: /usr/local/bin/log  
2021/04/17 13:24:57 …rm/session\_schema.go:25:Ping() [I] PING DATABASE postgresschema  
2021/04/17 13:24:57 …m.io/xorm/core/db.go:286:afterProcess() [I] [SQL] SELECT tablename FROM pg\_tables WHERE schemaname = $1 AND tablename = $2 [gitea version] - 3.120479ms  
2021/04/17 13:24:57 …m.io/xorm/core/db.go:286:afterProcess() [I] [SQL] CREATE TABLE IF NOT EXISTS “gitea”.“version” (“id” BIGSERIAL PRIMARY KEY NOT NULL, “version” BIGINT NULL) [] - 1.290791ms  
2021/04/17 13:24:57 cmd/migrate.go:38:runMigrate() [F] Failed to initialize ORM engine: migrate: sync: pq: schema “gitea” does not exist
- gitea admin create-user --username gitea\_admin --password ‘r8sA8CPHD9!bt6d’ --email gitea@local.domain --admin --must-change-password=false  
2021/04/17 13:24:57 …dules/setting/git.go:91:newGit() [I] Git Version: 2.26.3, Wire Protocol Version 2 Enabled  
…

Am I missing something?

The schema definitely exists:  
postgres=# \l  
List of databases  
Name | Owner | Encoding | Collate | Ctype | Access privileges  
-------------±-----------------±---------±--------±--------±----------------------  
gitea | gitea | UTF8 | C.UTF-8 | C.UTF-8 | =Tc/gitea +  
| | | | | gitea=CTc/gitea

and I’ve verified I can connect to it on that user.
