summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorShinya Maeda <shinya@gitlab.com>2019-01-02 10:40:33 +0900
committerShinya Maeda <shinya@gitlab.com>2019-01-04 22:17:02 +0900
commit66755c9ed506af9f51022a678ed26e5d31ee87ac (patch)
treeae453c58166702161f7544e74995c43822017deb /db
parentb4f4edd4eed2e469c2b19a12166232f48eaf2181 (diff)
downloadgitlab-ce-66755c9ed506af9f51022a678ed26e5d31ee87ac.tar.gz
Support CURD operation for release asset links
- Add Releases::Links model - Expose it in release API - Add integration tests
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20181228175414_create_releases_link_table.rb18
-rw-r--r--db/schema.rb10
2 files changed, 28 insertions, 0 deletions
diff --git a/db/migrate/20181228175414_create_releases_link_table.rb b/db/migrate/20181228175414_create_releases_link_table.rb
new file mode 100644
index 00000000000..bf1e50dd36e
--- /dev/null
+++ b/db/migrate/20181228175414_create_releases_link_table.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+class CreateReleasesLinkTable < ActiveRecord::Migration[5.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ create_table :release_links do |t|
+ t.references :release, null: false, index: false, foreign_key: { on_delete: :cascade }
+ t.string :url, null: false
+ t.string :name, null: false
+ t.timestamps_with_timezone null: false
+
+ t.index [:release_id, :name], unique: true
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 63267120c58..55b9a6aaf99 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -1798,6 +1798,15 @@ ActiveRecord::Schema.define(version: 20190103140724) do
t.index ["source_type", "source_id"], name: "index_redirect_routes_on_source_type_and_source_id", using: :btree
end
+ create_table "release_links", force: :cascade do |t|
+ t.integer "release_id", null: false
+ t.string "url", null: false
+ t.string "name", null: false
+ t.datetime_with_timezone "created_at", null: false
+ t.datetime_with_timezone "updated_at", null: false
+ t.index ["release_id", "name"], name: "index_release_links_on_release_id_and_name", unique: true, using: :btree
+ end
+
create_table "releases", force: :cascade do |t|
t.string "tag"
t.text "description"
@@ -2439,6 +2448,7 @@ ActiveRecord::Schema.define(version: 20190103140724) do
add_foreign_key "protected_tag_create_access_levels", "users"
add_foreign_key "protected_tags", "projects", name: "fk_8e4af87648", on_delete: :cascade
add_foreign_key "push_event_payloads", "events", name: "fk_36c74129da", on_delete: :cascade
+ add_foreign_key "release_links", "releases", on_delete: :cascade
add_foreign_key "releases", "projects", name: "fk_47fe2a0596", on_delete: :cascade
add_foreign_key "releases", "users", column: "author_id", name: "fk_8e4456f90f", on_delete: :nullify
add_foreign_key "remote_mirrors", "projects", on_delete: :cascade