I have added a auto incremented for one of the column by using snippet and schema.rb doesn't have anything related to creating below sequence.
ruby
execute <<-SQL
CREATE SEQUENCE booking_number_seq START 15000;
ALTER SEQUENCE booking_number_seq OWNED BY bookings.booking_number;
ALTER TABLE bookings ALTER COLUMN booking_number SET DEFAULT nextval('booking_number_seq');
SQL
My schema.rb should able to create complete db structure via bundle exec rake db:schema:load .
When I am running the schema load, it's breaking and can't able to find the sequence and below is the error.
ActiveRecord::StatementInvalid: PG::UndefinedTable: ERROR: relation "booking_number_seq" does not exist
Rails version: 5.2.1
Ruby version: 2.5.1p57
db/schema.rb cannot express everything your database may support such as triggers, sequences, stored procedures, check constraints, etc.
If you want to use SEQUENCE, please set the schema format to :sql.
Ref: https://edgeguides.rubyonrails.org/active_record_migrations.html#schema-dumping-and-you
Most helpful comment
db/schema.rbcannot express everything your database may support such as triggers, sequences, stored procedures, check constraints, etc.If you want to use
SEQUENCE, please set the schema format to:sql.Ref: https://edgeguides.rubyonrails.org/active_record_migrations.html#schema-dumping-and-you