3113: API server assigns task qsequence from a PostgreSQL sequence.
authorBrett Smith <brett@curoverse.com>
Wed, 9 Jul 2014 19:04:21 +0000 (15:04 -0400)
committerBrett Smith <brett@curoverse.com>
Mon, 14 Jul 2014 17:27:19 +0000 (13:27 -0400)
commit02de894919a054c31384aeda99a2c2de3a09ee60
tree2e11096593e1e35d6a22bbe5352db8f8a1eceb13
parent5a3fcd947082b668f2d6941b88f0cf6399d4ad1e
3113: API server assigns task qsequence from a PostgreSQL sequence.

We always wanted monotonically increasing qsequence values.  This
implements that.

Because sequences are specific to PostgreSQL, it can't be expressed in
schema.rb.  This commit switches our Rails configuration to dump the
database schema in SQL to capture that.

PostgreSQL supports assigning a column's default value from a
sequence, but this doesn't play well with ActiveRecord.  Without more
information, it always tries to assign NULL as the column value,
rather than leaving it unassigned to get the default.  We have to get
the value from inside the model.
services/api/app/models/job_task.rb
services/api/config/application.rb
services/api/db/migrate/20140709172343_job_task_serial_qsequence.rb [new file with mode: 0644]
services/api/db/schema.rb [deleted file]
services/api/db/structure.sql [new file with mode: 0644]
services/api/test/integration/jobs_api_test.rb
services/api/test/unit/job_task_test.rb