Skip to content

Instantly share code, notes, and snippets.

@mxgrn
Created December 23, 2023 03:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mxgrn/87e9a9b8090f4799b9841403079a6955 to your computer and use it in GitHub Desktop.
Save mxgrn/87e9a9b8090f4799b9841403079a6955 to your computer and use it in GitHub Desktop.
Renaming Elixir Phoenix app

Say, at some point you generated your Phoenix app with mix phx.new my_app, but later decided to change its name to "new_app".

See this little memo as a checklist to avoid possible pitfalls.

1. Project-wide search and replace

Use your favorite text editor to search and replace as follows (use case-sensitive search for minimizing chances for a mistake):

  • MyApp -> NewApp
  • my_app -> new_app

2. Rename files and folders

Any files and folders that include my_app in the name and/or path should be renamed accordingly.

At this point, make sure your test suite is green.

3. Rename Oban jobs

If you're using Oban, along with deployment, update the content of the oban_jobs.worker field, so it points to the new modules:

update oban_jobs set worker = REPLACE(worker, 'MyApp.', 'NewApp.')

Make sure to restart the application for Oban to pick up these changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment