summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-19 06:06:07 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-19 06:06:07 +0000
commit3209c1a49c14cab93eb347bfca59bace30879440 (patch)
treec9f931b477fefc1e5056380eb3370c689c2fa732 /db
parent7f3bff1556594dcdc1beca40d083ba7263965e21 (diff)
downloadgitlab-ce-3209c1a49c14cab93eb347bfca59bace30879440.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20191025092748_add_secret_token_to_snippet.rb10
-rw-r--r--db/migrate/20191105155113_add_secret_to_snippet.rb27
-rw-r--r--db/schema.rb5
3 files changed, 41 insertions, 1 deletions
diff --git a/db/migrate/20191025092748_add_secret_token_to_snippet.rb b/db/migrate/20191025092748_add_secret_token_to_snippet.rb
new file mode 100644
index 00000000000..0649f58d23e
--- /dev/null
+++ b/db/migrate/20191025092748_add_secret_token_to_snippet.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+class AddSecretTokenToSnippet < ActiveRecord::Migration[5.2]
+ DOWNTIME = false
+
+ def change
+ add_column :snippets, :encrypted_secret_token, :string, limit: 255
+ add_column :snippets, :encrypted_secret_token_iv, :string, limit: 255
+ end
+end
diff --git a/db/migrate/20191105155113_add_secret_to_snippet.rb b/db/migrate/20191105155113_add_secret_to_snippet.rb
new file mode 100644
index 00000000000..ae514d48494
--- /dev/null
+++ b/db/migrate/20191105155113_add_secret_to_snippet.rb
@@ -0,0 +1,27 @@
+# frozen_string_literal: true
+
+class AddSecretToSnippet < ActiveRecord::Migration[5.2]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ unless column_exists?(:snippets, :secret)
+ add_column_with_default :snippets, :secret, :boolean, default: false
+ end
+
+ add_concurrent_index :snippets, [:visibility_level, :secret]
+ remove_concurrent_index :snippets, :visibility_level
+ end
+
+ def down
+ add_concurrent_index :snippets, :visibility_level
+ remove_concurrent_index :snippets, [:visibility_level, :secret]
+
+ if column_exists?(:snippets, :secret)
+ remove_column :snippets, :secret
+ end
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index e3413722991..2ecf96c71cb 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -3555,13 +3555,16 @@ ActiveRecord::Schema.define(version: 2019_11_15_091425) do
t.integer "cached_markdown_version"
t.text "description"
t.text "description_html"
+ t.string "encrypted_secret_token", limit: 255
+ t.string "encrypted_secret_token_iv", limit: 255
+ t.boolean "secret", default: false, null: false
t.index ["author_id"], name: "index_snippets_on_author_id"
t.index ["content"], name: "index_snippets_on_content_trigram", opclass: :gin_trgm_ops, using: :gin
t.index ["file_name"], name: "index_snippets_on_file_name_trigram", opclass: :gin_trgm_ops, using: :gin
t.index ["project_id", "visibility_level"], name: "index_snippets_on_project_id_and_visibility_level"
t.index ["title"], name: "index_snippets_on_title_trigram", opclass: :gin_trgm_ops, using: :gin
t.index ["updated_at"], name: "index_snippets_on_updated_at"
- t.index ["visibility_level"], name: "index_snippets_on_visibility_level"
+ t.index ["visibility_level", "secret"], name: "index_snippets_on_visibility_level_and_secret"
end
create_table "software_license_policies", id: :serial, force: :cascade do |t|