diff options
author | Jason Goodman <jgoodman@gitlab.com> | 2019-07-03 09:12:15 +0000 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2019-07-03 09:12:15 +0000 |
commit | 7ecffe2987e0f3953489759d080fc263c5cb95c5 (patch) | |
tree | e9a01188b0b731b997a14f795dc44f22a0c7f708 /db | |
parent | d6391c650344af7018de8a3dc6a756b2db9e4f6e (diff) | |
download | gitlab-ce-7ecffe2987e0f3953489759d080fc263c5cb95c5.tar.gz |
Show upcoming status for releases
Add released_at field to releases API
Add released_at column to releases table
Return releases to the API sorted by released_at
Diffstat (limited to 'db')
3 files changed, 31 insertions, 1 deletions
diff --git a/db/migrate/20190628185000_add_released_at_to_releases_table.rb b/db/migrate/20190628185000_add_released_at_to_releases_table.rb new file mode 100644 index 00000000000..ae55aa434d9 --- /dev/null +++ b/db/migrate/20190628185000_add_released_at_to_releases_table.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class AddReleasedAtToReleasesTable < ActiveRecord::Migration[5.1] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + add_column(:releases, :released_at, :datetime_with_timezone) + end +end diff --git a/db/migrate/20190628185004_backfill_and_add_not_null_constraint_to_released_at_column_on_releases_table.rb b/db/migrate/20190628185004_backfill_and_add_not_null_constraint_to_released_at_column_on_releases_table.rb new file mode 100644 index 00000000000..1e5d3e8f235 --- /dev/null +++ b/db/migrate/20190628185004_backfill_and_add_not_null_constraint_to_released_at_column_on_releases_table.rb @@ -0,0 +1,18 @@ +# frozen_string_literal: true + +class BackfillAndAddNotNullConstraintToReleasedAtColumnOnReleasesTable < ActiveRecord::Migration[5.1] + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + update_column_in_batches(:releases, :released_at, Arel.sql('created_at')) + change_column_null(:releases, :released_at, false) + end + + def down + change_column_null(:releases, :released_at, true) + end +end diff --git a/db/schema.rb b/db/schema.rb index 143f6c7127e..32a25f643ce 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20190628145246) do +ActiveRecord::Schema.define(version: 20190628185004) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -2902,6 +2902,7 @@ ActiveRecord::Schema.define(version: 20190628145246) do t.integer "author_id" t.string "name" t.string "sha" + t.datetime_with_timezone "released_at", null: false t.index ["author_id"], name: "index_releases_on_author_id", using: :btree t.index ["project_id", "tag"], name: "index_releases_on_project_id_and_tag", using: :btree t.index ["project_id"], name: "index_releases_on_project_id", using: :btree |