[openstreetmap/openstreetmap-website] Simplify primary key for relation members tables (PR #4300)

Andy Allan notifications at github.com
Thu Oct 26 11:00:30 UTC 2023


I'm happy with the change. I'd like to suggest a different approach in the tests. Since the actual values of the `sequence_id` aren't important (they are never displayed anywhere, they just need to be larger and different than the previously used one) then we can use a Factorybot sequence for them:

```diff
 FactoryBot.define do
   factory :relation_member do
-    sequence_id { 1 }
+    sequence(:sequence_id)
```

```diff
 FactoryBot.define do
   factory :old_relation_member do
+    sequence(:sequence_id)
     member_role { "" }
```

Then we don't have to introduce all the explicit references to sequence_ids elsewhere in the tests. They'll be incremented automatically (albeit not starting from 1 for each relation, but who cares), and can still be overridden when necessary.

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

Message ID: <openstreetmap/openstreetmap-website/pull/4300/c1780892696 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20231026/0ae8006b/attachment.htm>


More information about the rails-dev mailing list