I thought I had the solution here: application-wide sequence It looks like behaviour has changed since Rails 5.
I define a specific sequence to handle my objects ids:
class BusinessRule < ActiveRecord::Base
### id generation
self.sequence_name = "objects_seq"
The migration, (which ran before I edit the model), generated a sequence for Business Rules:
business_rules_id_seq
And this sequence is referenced in the COLUMN_DEF attribute of the business_rules.id column.
Despite the self.sequence_name directive, ActiveRecord still uses the conventional sequence business_rules_id_seq. Deleting the sequence does not change a thing.
Can you help ?