[openstreetmap/openstreetmap-website] DB seed script (PR #6432)

Pablo Brasero notifications at github.com
Tue Oct 7 14:19:40 UTC 2025


Another extraction from https://github.com/openstreetmap/openstreetmap-website/pull/6424

In order:
1. Extract the code of the `oauth:register_apps` task into a method, to allow reuse.
2. Use this to create an initial user `admin`.
3. Run `yarn install` in `bin/setup`, or it may not work.
    - Related enough to this work. I was trying to get a user created by running `bin/setup`, which includes `db:prepare` and in turn runs `db:seed`.

This takes inspiration from @mmd's https://gist.github.com/mmd-osm/a3a0b5a8799a333e7fae578038aa7a93, but is much simpler. We can think about adding more in the future.

Also related to @gravitystorm's https://github.com/openstreetmap/openstreetmap-website/pull/3101 (I should have a look at that).
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/6432

-- Commit Summary --

  * Refactor to allow reuse
  * Simple seed script to provide an initial user
  * NPM packages required to run db:prepare

-- File Changes --

    M bin/setup (1)
    M db/seeds.rb (36)
    A lib/oauth/util.rb (69)
    M lib/tasks/register_oauth_apps.rake (52)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/6432.patch
https://github.com/openstreetmap/openstreetmap-website/pull/6432.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6432
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/6432 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20251007/4fc6af5f/attachment.htm>


More information about the rails-dev mailing list