ifActiveRecord::Base.connection.execute("SELECT 1 as value FROM pg_class c WHERE c.relkind = 'S' and c.relname = 'planning_element_type_colors_id_seq'").to_a.present?||
begin
puts"Renaming id_seq to pkey which seems to be required by rename_table"
**Please note:** Ensure that the URL starts with `mysql://` , not with ` mysql2://` !
**Please note:** Ensure that the URL starts with `mysql://` , not with ` mysql2://` !
### The PostgreSQL DATABASE_URL
### The PostgreSQL DATABASE_URL
Pass in `DATABASE_URL` pointing to your new PostgreSQL database. This is either the default `postgres://openproject:openproject@127.0.0.1/openproject` or if you set up a PostgreSQL installation above, use credentials for your installation you set up above.
Pass in `DATABASE_URL` pointing to your new PostgreSQL database. This is either the default `postgres://openproject:openproject@127.0.0.1/openproject` or if you set up a PostgreSQL installation above, use credentials for your installation you set up above.
**Note:** Depending on your docker installation and networking, you may need to replace the hostname `localhost` in the database URLs
with `host.docker.internal` to access the docker host. On Mac for example, localhost will refer to the docker client.
### Running the migration
### Running the migration
To run the migration script within the container, now simply run the following command, replacing the content of the environment variables with your actual values.
To run the migration script within the container, now simply run the following command, replacing the content of the environment variables with your actual values.
OpenProject provides a simple conversion script that you can run as a single command via Docker.
OpenProject provides a simple conversion script that you can run as a single command via Docker.
@ -82,16 +78,20 @@ OpenProject provides a simple conversion script that you can run as a single com
To run the migration script within the container, simply run the following command, replacing the content of the environment variables with your actual values.
To run the migration script within the container, simply run the following command, replacing the content of the environment variables with your actual values.
### Adapting the hostname
**Note:** Depending on your docker installation and networking, you may need to replace the hostname `localhost` in the database URLs
with `host.docker.internal` to access the docker host. On Mac for example, localhost will refer to the docker client.
```bash
```bash
docker run \
docker run -it \
-it openproject/community:latest
-e MYSQL_DATABASE_URL=$MYSQL_DATABASE_URL \
-e MYSQL_DATABASE_URL=$MYSQL_DATABASE_URL \
-e DATABASE_URL=$POSTGRES_DATABASE_URL
-e DATABASE_URL=$POSTGRES_DATABASE_URL \
openproject/community:latest
```
```
This will perform all necessary steps to perform the migration. Afterwards, simply remove the `MYSQL_DATABASE_URL`environment variable again and start your container as usual.
This will perform all necessary steps to perform the migration. Afterwards, simply remove the `MYSQL_DATABASE_URL`environment variable again and start your container as usual.