# ERROR "sql schema version compatibility check failed: unable to read DB schema version keyspace/database: temporal error: pq: relation "schema\_version" does not exis"

**URL:** <https://community.temporal.io/t/error-sql-schema-version-compatibility-check-failed-unable-to-read-db-schema-version-keyspace-database-temporal-error-pq-relation-schema-version-does-not-exis/7186>\
**Category:** Community Support\
**Created:** [February 7, 2023, 9:58am UTC](https://community.temporal.io/t/error-sql-schema-version-compatibility-check-failed-unable-to-read-db-schema-version-keyspace-database-temporal-error-pq-relation-schema-version-does-not-exis/7186 "2023-02-07T09:58:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ismath](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/ismath/32/3756_2.png) [@ismath](https://community.temporal.io/u/ismath)\
**Post date:** [February 7, 2023, 9:58am UTC](https://community.temporal.io/t/error-sql-schema-version-compatibility-check-failed-unable-to-read-db-schema-version-keyspace-database-temporal-error-pq-relation-schema-version-does-not-exis/7186/1 "2023-02-07T09:58:37Z")

</div>

Hi  
I am following this [doc](https://docs.temporal.io/server/production-deployment) for self-hosting temporal for the production environment and settled the config file using the below link

[https://github.dev/temporalio/temporal/blob/master/config/development-postgres.yaml](https://github.dev/temporalio/temporal/blob/master/config/development-postgres.yaml)

In the Postgres DB, I have two databases `temporal` and `temporal_visibility`.

Using the below Docker run command

```auto
docker run \
  -e SERVICES=history,matching,worker,frontend \
  -e LOG_LEVEL=info \
  -e DYNAMIC_CONFIG_FILE_PATH=<CONFIG_FILE_LOCATION>/config/docker.yaml \
  -v <CONFIG_FILE_LOCATION>/config/docker.yaml:/etc/temporal/config/config_template.yaml \
  -v <CONFIG_FILE_LOCATION>/config/dynamicconfig/development-sql.yaml:/etc/temporal/config/dynamicconfig/development-sql.yaml \
  temporalio/server:latest

```

Error:

```auto
[Fx] PROVIDE fx.Shutdowner <= go.uber.org/fx.(*App).shutdowner-fm()
[Fx] PROVIDE fx.DotGraph <= go.uber.org/fx.(*App).dotGraph-fm()
[Fx] ERROR Failed to initialize custom logger: could not build arguments for function "go.uber.org/fx".(*App).constructCustomLogger.func2
        /go/pkg/mod/go.uber.org/fx@v1.18.2/app.go:414:
failed to build fxevent.Logger:
could not build arguments for function "go.temporal.io/server/temporal".glob..func8
        /home/builder/temporal/temporal/fx.go:921:
failed to build log.Logger:
received non-nil error from function "go.temporal.io/server/temporal".ServerOptionsProvider
        /home/builder/temporal/temporal/fx.go:158:
sql schema version compatibility check failed: unable to read DB schema version keyspace/database: temporal error: pq: relation "schema_version" does not exist
Unable to create server. Error: could not build arguments for function "go.uber.org/fx".(*App).constructCustomLogger.func2 (/go/pkg/mod/go.uber.org/fx@v1.18.2/app.go:414): failed to build fxevent.Logger: could not build arguments for function "go.temporal.io/server/temporal".glob..func8 (/home/builder/temporal/temporal/fx.go:921): failed to build log.Logger: received non-nil error from function "go.temporal.io/server/temporal".ServerOptionsProvider (/home/builder/temporal/temporal/fx.go:158): sql schema version compatibility check failed: unable to read DB schema version keyspace/database: temporal error: pq: relation "schema_version" does not exist

```

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [February 7, 2023, 2:37pm UTC](https://community.temporal.io/t/error-sql-schema-version-compatibility-check-failed-unable-to-read-db-schema-version-keyspace-database-temporal-error-pq-relation-schema-version-does-not-exis/7186/2 "2023-02-07T14:37:49Z")

</div>

I think couple of things are missing on that page you linked. You have to set up your persistence and visibility schemas up-front (not just create temporal, temporal\_visibility).

If you intend to use the temporalio/server image (advised to use so you can set up each service role on independent container) you would need to either set up schemas before you stand up cluster via script or maybe make it entry-point of admin-tolls image, see sample [here](https://github.com/tsurdilo/my-temporal-dockercompose/blob/main/docker-compose-services.yml#L195-L198).

Also the service has two config files, static and dynamic config. Static config is required and for the temporalio/server image its [generated](https://github.com/temporalio/docker-builds/blob/main/docker/entrypoint.sh#L21) for you from [default template](https://github.com/temporalio/temporal/blob/master/docker/config_template.yaml) and the env vars you set. You can also create your custom template if you wanted to expose some fields that are not in default template or you want to restrict it in ways, see sample [here](https://github.com/tsurdilo/my-temporal-dockercompose#custom-docker-template).

I think if you want to stand up cluster quick on docker with each service role in its own container, use compose sample [here](https://github.com/tsurdilo/my-temporal-dockercompose#deploying-without-auto-setup) which by the way is being moved to our official docker compose repo too, see pr [here](https://github.com/temporalio/docker-compose/pull/163).

One more thing, dont use “latest” as your image version. It can lead to issues. Best practice would be to always define a specific version for your images.

---

<div class="post-metadata">

**Author:** ![ismath](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/ismath/32/3756_2.png) [@ismath](https://community.temporal.io/u/ismath)\
**Post date:** [February 9, 2023, 5:10am UTC](https://community.temporal.io/t/error-sql-schema-version-compatibility-check-failed-unable-to-read-db-schema-version-keyspace-database-temporal-error-pq-relation-schema-version-does-not-exis/7186/3 "2023-02-09T05:10:25Z")

</div>

Thank you for your reply.  
I was able to spin stand alone temporal following this [repo](https://github.com/tsurdilo/my-temporal-dockercompose#deploying-without-auto-setup) that you shared.

Understood from one official doc that the minimum Temporal Server dependency is a database and all the grafana, elastic search etc. are only optional.

I need to spin my temporal standalone server with AWS RDS as database and currently not going with any additional feature. Can you please help on this.
