schema.rb 52 KB
Newer Older
Andrew8xx8's avatar
Andrew8xx8 committed
1 2 3 4 5 6 7 8 9 10 11
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative source for your
# database schema. If you need to create the application database on another
# system, you should be using db:schema:load, not running all the migrations
# from scratch. The latter is a flawed and unsustainable approach (the more migrations
# you'll amass, the slower it'll run and the greater likelihood for issues).
#
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
12
# It's strongly recommended that you check this file into your version control system.
Andrew8xx8's avatar
Andrew8xx8 committed
13

14
ActiveRecord::Schema.define(version: 20160712171823) do
15

Kamil Trzcinski's avatar
Kamil Trzcinski committed
16 17
  # These are extensions that must be enabled in order to support this database
  enable_extension "plpgsql"
18
  enable_extension "pg_trgm"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
19

Valery Sizov's avatar
Valery Sizov committed
20
  create_table "abuse_reports", force: :cascade do |t|
21 22 23 24 25 26 27
    t.integer  "reporter_id"
    t.integer  "user_id"
    t.text     "message"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

28 29 30 31 32 33 34 35 36
  create_table "appearances", force: :cascade do |t|
    t.string   "title"
    t.text     "description"
    t.string   "header_logo"
    t.string   "logo"
    t.datetime "created_at",  null: false
    t.datetime "updated_at",  null: false
  end

Valery Sizov's avatar
Valery Sizov committed
37
  create_table "application_settings", force: :cascade do |t|
38 39 40 41 42 43 44
    t.integer  "default_projects_limit"
    t.boolean  "signup_enabled"
    t.boolean  "signin_enabled"
    t.boolean  "gravatar_enabled"
    t.text     "sign_in_text"
    t.datetime "created_at"
    t.datetime "updated_at"
45
    t.string   "home_page_url"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
46
    t.integer  "default_branch_protection",             default: 2
47
    t.text     "restricted_visibility_levels"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
48 49
    t.boolean  "version_check_enabled",                 default: true
    t.integer  "max_attachment_size",                   default: 10,          null: false
Vinnie Okada's avatar
Vinnie Okada committed
50 51
    t.integer  "default_project_visibility"
    t.integer  "default_snippet_visibility"
52
    t.text     "restricted_signup_domains"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
53
    t.boolean  "user_oauth_applications",               default: true
54
    t.string   "after_sign_out_path"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
55
    t.integer  "session_expire_delay",                  default: 10080,       null: false
56
    t.text     "import_sources"
Kamil Trzcinski's avatar
WIP  
Kamil Trzcinski committed
57
    t.text     "help_page_text"
58
    t.string   "admin_notification_email"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
59 60
    t.boolean  "shared_runners_enabled",                default: true,        null: false
    t.integer  "max_artifacts_size",                    default: 100,         null: false
61
    t.string   "runners_registration_token"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
62 63 64 65 66 67 68 69
    t.boolean  "require_two_factor_authentication",     default: false
    t.integer  "two_factor_grace_period",               default: 48
    t.boolean  "metrics_enabled",                       default: false
    t.string   "metrics_host",                          default: "localhost"
    t.integer  "metrics_pool_size",                     default: 16
    t.integer  "metrics_timeout",                       default: 10
    t.integer  "metrics_method_call_threshold",         default: 10
    t.boolean  "recaptcha_enabled",                     default: false
70 71
    t.string   "recaptcha_site_key"
    t.string   "recaptcha_private_key"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
72 73 74
    t.integer  "metrics_port",                          default: 8089
    t.integer  "metrics_sample_interval",               default: 15
    t.boolean  "sentry_enabled",                        default: false
Jeroen Nijhof's avatar
Jeroen Nijhof committed
75
    t.string   "sentry_dsn"
76 77
    t.boolean  "akismet_enabled",                       default: false
    t.string   "akismet_api_key"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
78
    t.boolean  "email_author_in_body",                  default: false
Douwe Maan's avatar
Douwe Maan committed
79
    t.integer  "default_group_visibility"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
80
    t.boolean  "repository_checks_enabled",             default: false
81
    t.text     "shared_runners_text"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
82
    t.integer  "metrics_packet_size",                   default: 1
83
    t.text     "disabled_oauth_sign_in_sources"
84
    t.string   "health_check_access_token"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
85
    t.boolean  "send_user_confirmation_email",          default: false
86
    t.integer  "container_registry_token_expire_delay", default: 5
87
    t.text     "after_sign_up_text"
88
    t.string   "repository_storage",                    default: "default"
89
    t.string   "enabled_git_access_protocol"
90
    t.boolean  "user_default_external",                 default: false,       null: false
91 92
  end

Valery Sizov's avatar
Valery Sizov committed
93
  create_table "audit_events", force: :cascade do |t|
94 95 96 97
    t.integer  "author_id",   null: false
    t.string   "type",        null: false
    t.integer  "entity_id",   null: false
    t.string   "entity_type", null: false
98 99 100 101 102 103 104 105 106
    t.text     "details"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "audit_events", ["author_id"], name: "index_audit_events_on_author_id", using: :btree
  add_index "audit_events", ["entity_id", "entity_type"], name: "index_audit_events_on_entity_id_and_entity_type", using: :btree
  add_index "audit_events", ["type"], name: "index_audit_events_on_type", using: :btree

107 108 109 110 111 112 113 114 115
  create_table "award_emoji", force: :cascade do |t|
    t.string   "name"
    t.integer  "user_id"
    t.integer  "awardable_id"
    t.string   "awardable_type"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

Z.J. van de Weg's avatar
Z.J. van de Weg committed
116
  add_index "award_emoji", ["awardable_type", "awardable_id"], name: "index_award_emoji_on_awardable_type_and_awardable_id", using: :btree
117
  add_index "award_emoji", ["user_id", "name"], name: "index_award_emoji_on_user_id_and_name", using: :btree
118 119
  add_index "award_emoji", ["user_id"], name: "index_award_emoji_on_user_id", using: :btree

Valery Sizov's avatar
Valery Sizov committed
120
  create_table "broadcast_messages", force: :cascade do |t|
121
    t.text     "message",    null: false
122 123
    t.datetime "starts_at"
    t.datetime "ends_at"
124 125
    t.datetime "created_at"
    t.datetime "updated_at"
126 127
    t.string   "color"
    t.string   "font"
128
  end
129

Valery Sizov's avatar
Valery Sizov committed
130
  create_table "ci_application_settings", force: :cascade do |t|
Douwe Maan's avatar
Douwe Maan committed
131 132 133 134 135 136
    t.boolean  "all_broken_builds"
    t.boolean  "add_pusher"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

Valery Sizov's avatar
Valery Sizov committed
137
  create_table "ci_builds", force: :cascade do |t|
Douwe Maan's avatar
Douwe Maan committed
138
    t.integer  "project_id"
139
    t.string   "status"
Douwe Maan's avatar
Douwe Maan committed
140
    t.datetime "finished_at"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
141
    t.text     "trace"
Douwe Maan's avatar
Douwe Maan committed
142 143 144 145
    t.datetime "created_at"
    t.datetime "updated_at"
    t.datetime "started_at"
    t.integer  "runner_id"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
146
    t.float    "coverage"
Douwe Maan's avatar
Douwe Maan committed
147 148 149
    t.integer  "commit_id"
    t.text     "commands"
    t.integer  "job_id"
150
    t.string   "name"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
151
    t.boolean  "deploy",              default: false
Douwe Maan's avatar
Douwe Maan committed
152
    t.text     "options"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
153
    t.boolean  "allow_failure",       default: false, null: false
154
    t.string   "stage"
Douwe Maan's avatar
Douwe Maan committed
155
    t.integer  "trigger_request_id"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
156 157
    t.integer  "stage_idx"
    t.boolean  "tag"
158
    t.string   "ref"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
159
    t.integer  "user_id"
160 161 162
    t.string   "type"
    t.string   "target_url"
    t.string   "description"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
163
    t.text     "artifacts_file"
164
    t.integer  "gl_project_id"
165
    t.text     "artifacts_metadata"
166 167
    t.integer  "erased_by_id"
    t.datetime "erased_at"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
168
    t.datetime "artifacts_expire_at"
169
    t.string   "environment"
170
    t.integer  "artifacts_size"
Douwe Maan's avatar
Douwe Maan committed
171 172
  end

Kamil Trzcinski's avatar
Kamil Trzcinski committed
173
  add_index "ci_builds", ["commit_id", "stage_idx", "created_at"], name: "index_ci_builds_on_commit_id_and_stage_idx_and_created_at", using: :btree
174
  add_index "ci_builds", ["commit_id", "status", "type"], name: "index_ci_builds_on_commit_id_and_status_and_type", using: :btree
Kamil Trzcinski's avatar
Kamil Trzcinski committed
175 176
  add_index "ci_builds", ["commit_id", "type", "name", "ref"], name: "index_ci_builds_on_commit_id_and_type_and_name_and_ref", using: :btree
  add_index "ci_builds", ["commit_id", "type", "ref"], name: "index_ci_builds_on_commit_id_and_type_and_ref", using: :btree
Douwe Maan's avatar
Douwe Maan committed
177
  add_index "ci_builds", ["commit_id"], name: "index_ci_builds_on_commit_id", using: :btree
178
  add_index "ci_builds", ["erased_by_id"], name: "index_ci_builds_on_erased_by_id", using: :btree
179
  add_index "ci_builds", ["gl_project_id"], name: "index_ci_builds_on_gl_project_id", using: :btree
Douwe Maan's avatar
Douwe Maan committed
180 181 182
  add_index "ci_builds", ["project_id", "commit_id"], name: "index_ci_builds_on_project_id_and_commit_id", using: :btree
  add_index "ci_builds", ["project_id"], name: "index_ci_builds_on_project_id", using: :btree
  add_index "ci_builds", ["runner_id"], name: "index_ci_builds_on_runner_id", using: :btree
183 184
  add_index "ci_builds", ["status"], name: "index_ci_builds_on_status", using: :btree
  add_index "ci_builds", ["type"], name: "index_ci_builds_on_type", using: :btree
Douwe Maan's avatar
Douwe Maan committed
185

Valery Sizov's avatar
Valery Sizov committed
186
  create_table "ci_commits", force: :cascade do |t|
Douwe Maan's avatar
Douwe Maan committed
187
    t.integer  "project_id"
188 189 190
    t.string   "ref"
    t.string   "sha"
    t.string   "before_sha"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
191
    t.text     "push_data"
Douwe Maan's avatar
Douwe Maan committed
192 193
    t.datetime "created_at"
    t.datetime "updated_at"
194
    t.boolean  "tag",           default: false
Douwe Maan's avatar
Douwe Maan committed
195 196
    t.text     "yaml_errors"
    t.datetime "committed_at"
Kamil Trzcinski's avatar
WIP  
Kamil Trzcinski committed
197
    t.integer  "gl_project_id"
198 199 200 201
    t.string   "status"
    t.datetime "started_at"
    t.datetime "finished_at"
    t.integer  "duration"
Douwe Maan's avatar
Douwe Maan committed
202 203
  end

204 205
  add_index "ci_commits", ["gl_project_id", "sha"], name: "index_ci_commits_on_gl_project_id_and_sha", using: :btree
  add_index "ci_commits", ["gl_project_id", "status"], name: "index_ci_commits_on_gl_project_id_and_status", using: :btree
206
  add_index "ci_commits", ["gl_project_id"], name: "index_ci_commits_on_gl_project_id", using: :btree
Kamil Trzcinski's avatar
Kamil Trzcinski committed
207
  add_index "ci_commits", ["project_id", "committed_at", "id"], name: "index_ci_commits_on_project_id_and_committed_at_and_id", using: :btree
Douwe Maan's avatar
Douwe Maan committed
208 209 210 211
  add_index "ci_commits", ["project_id", "committed_at"], name: "index_ci_commits_on_project_id_and_committed_at", using: :btree
  add_index "ci_commits", ["project_id", "sha"], name: "index_ci_commits_on_project_id_and_sha", using: :btree
  add_index "ci_commits", ["project_id"], name: "index_ci_commits_on_project_id", using: :btree
  add_index "ci_commits", ["sha"], name: "index_ci_commits_on_sha", using: :btree
212
  add_index "ci_commits", ["status"], name: "index_ci_commits_on_status", using: :btree
Douwe Maan's avatar
Douwe Maan committed
213

Valery Sizov's avatar
Valery Sizov committed
214
  create_table "ci_events", force: :cascade do |t|
Douwe Maan's avatar
Douwe Maan committed
215 216 217 218 219 220 221 222 223 224 225 226
    t.integer  "project_id"
    t.integer  "user_id"
    t.integer  "is_admin"
    t.text     "description"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "ci_events", ["created_at"], name: "index_ci_events_on_created_at", using: :btree
  add_index "ci_events", ["is_admin"], name: "index_ci_events_on_is_admin", using: :btree
  add_index "ci_events", ["project_id"], name: "index_ci_events_on_project_id", using: :btree

Valery Sizov's avatar
Valery Sizov committed
227
  create_table "ci_jobs", force: :cascade do |t|
228
    t.integer  "project_id",                          null: false
Douwe Maan's avatar
Douwe Maan committed
229
    t.text     "commands"
230
    t.boolean  "active",         default: true,       null: false
Douwe Maan's avatar
Douwe Maan committed
231 232
    t.datetime "created_at"
    t.datetime "updated_at"
233 234 235 236 237
    t.string   "name"
    t.boolean  "build_branches", default: true,       null: false
    t.boolean  "build_tags",     default: false,      null: false
    t.string   "job_type",       default: "parallel"
    t.string   "refs"
Douwe Maan's avatar
Douwe Maan committed
238 239 240 241 242 243
    t.datetime "deleted_at"
  end

  add_index "ci_jobs", ["deleted_at"], name: "index_ci_jobs_on_deleted_at", using: :btree
  add_index "ci_jobs", ["project_id"], name: "index_ci_jobs_on_project_id", using: :btree

Valery Sizov's avatar
Valery Sizov committed
244
  create_table "ci_projects", force: :cascade do |t|
245 246
    t.string   "name"
    t.integer  "timeout",                  default: 3600,  null: false
Douwe Maan's avatar
Douwe Maan committed
247 248
    t.datetime "created_at"
    t.datetime "updated_at"
249 250 251 252
    t.string   "token"
    t.string   "default_ref"
    t.string   "path"
    t.boolean  "always_build",             default: false, null: false
Douwe Maan's avatar
Douwe Maan committed
253
    t.integer  "polling_interval"
254 255
    t.boolean  "public",                   default: false, null: false
    t.string   "ssh_url_to_repo"
Douwe Maan's avatar
Douwe Maan committed
256
    t.integer  "gitlab_id"
257 258 259 260 261 262 263
    t.boolean  "allow_git_fetch",          default: true,  null: false
    t.string   "email_recipients",         default: "",    null: false
    t.boolean  "email_add_pusher",         default: true,  null: false
    t.boolean  "email_only_broken_builds", default: true,  null: false
    t.string   "skip_refs"
    t.string   "coverage_regex"
    t.boolean  "shared_runners_enabled",   default: false
Douwe Maan's avatar
Douwe Maan committed
264 265 266
    t.text     "generated_yaml_config"
  end

267 268 269
  add_index "ci_projects", ["gitlab_id"], name: "index_ci_projects_on_gitlab_id", using: :btree
  add_index "ci_projects", ["shared_runners_enabled"], name: "index_ci_projects_on_shared_runners_enabled", using: :btree

Valery Sizov's avatar
Valery Sizov committed
270
  create_table "ci_runner_projects", force: :cascade do |t|
271 272
    t.integer  "runner_id",     null: false
    t.integer  "project_id"
Douwe Maan's avatar
Douwe Maan committed
273 274
    t.datetime "created_at"
    t.datetime "updated_at"
275
    t.integer  "gl_project_id"
Douwe Maan's avatar
Douwe Maan committed
276 277
  end

278
  add_index "ci_runner_projects", ["gl_project_id"], name: "index_ci_runner_projects_on_gl_project_id", using: :btree
Douwe Maan's avatar
Douwe Maan committed
279 280
  add_index "ci_runner_projects", ["runner_id"], name: "index_ci_runner_projects_on_runner_id", using: :btree

Valery Sizov's avatar
Valery Sizov committed
281
  create_table "ci_runners", force: :cascade do |t|
282
    t.string   "token"
Douwe Maan's avatar
Douwe Maan committed
283 284
    t.datetime "created_at"
    t.datetime "updated_at"
285
    t.string   "description"
Douwe Maan's avatar
Douwe Maan committed
286
    t.datetime "contacted_at"
287 288 289 290 291 292 293
    t.boolean  "active",       default: true,  null: false
    t.boolean  "is_shared",    default: false
    t.string   "name"
    t.string   "version"
    t.string   "revision"
    t.string   "platform"
    t.string   "architecture"
294
    t.boolean  "run_untagged", default: true,  null: false
295
    t.boolean  "locked",       default: false, null: false
Douwe Maan's avatar
Douwe Maan committed
296 297
  end

298
  add_index "ci_runners", ["description"], name: "index_ci_runners_on_description_trigram", using: :gin, opclasses: {"description"=>"gin_trgm_ops"}
299
  add_index "ci_runners", ["locked"], name: "index_ci_runners_on_locked", using: :btree
James Lopez's avatar
James Lopez committed
300
  add_index "ci_runners", ["token"], name: "index_ci_runners_on_token", using: :btree
301
  add_index "ci_runners", ["token"], name: "index_ci_runners_on_token_trigram", using: :gin, opclasses: {"token"=>"gin_trgm_ops"}
302

Valery Sizov's avatar
Valery Sizov committed
303
  create_table "ci_services", force: :cascade do |t|
304 305 306
    t.string   "type"
    t.string   "title"
    t.integer  "project_id",                 null: false
Douwe Maan's avatar
Douwe Maan committed
307 308
    t.datetime "created_at"
    t.datetime "updated_at"
309
    t.boolean  "active",     default: false, null: false
Douwe Maan's avatar
Douwe Maan committed
310 311 312 313 314
    t.text     "properties"
  end

  add_index "ci_services", ["project_id"], name: "index_ci_services_on_project_id", using: :btree

Valery Sizov's avatar
Valery Sizov committed
315
  create_table "ci_sessions", force: :cascade do |t|
316
    t.string   "session_id", null: false
Douwe Maan's avatar
Douwe Maan committed
317 318 319 320 321 322 323 324
    t.text     "data"
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "ci_sessions", ["session_id"], name: "index_ci_sessions_on_session_id", using: :btree
  add_index "ci_sessions", ["updated_at"], name: "index_ci_sessions_on_updated_at", using: :btree

Valery Sizov's avatar
Valery Sizov committed
325
  create_table "ci_taggings", force: :cascade do |t|
326 327
    t.integer  "tag_id"
    t.integer  "taggable_id"
328
    t.string   "taggable_type"
329
    t.integer  "tagger_id"
330
    t.string   "tagger_type"
331 332 333 334 335 336 337
    t.string   "context",       limit: 128
    t.datetime "created_at"
  end

  add_index "ci_taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "ci_taggings_idx", unique: true, using: :btree
  add_index "ci_taggings", ["taggable_id", "taggable_type", "context"], name: "index_ci_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree

Valery Sizov's avatar
Valery Sizov committed
338
  create_table "ci_tags", force: :cascade do |t|
339 340
    t.string  "name"
    t.integer "taggings_count", default: 0
341 342 343 344
  end

  add_index "ci_tags", ["name"], name: "index_ci_tags_on_name", unique: true, using: :btree

Valery Sizov's avatar
Valery Sizov committed
345
  create_table "ci_trigger_requests", force: :cascade do |t|
Douwe Maan's avatar
Douwe Maan committed
346 347 348 349 350 351 352
    t.integer  "trigger_id", null: false
    t.text     "variables"
    t.datetime "created_at"
    t.datetime "updated_at"
    t.integer  "commit_id"
  end

Valery Sizov's avatar
Valery Sizov committed
353
  create_table "ci_triggers", force: :cascade do |t|
354
    t.string   "token"
355
    t.integer  "project_id"
Douwe Maan's avatar
Douwe Maan committed
356 357 358
    t.datetime "deleted_at"
    t.datetime "created_at"
    t.datetime "updated_at"
359
    t.integer  "gl_project_id"
Douwe Maan's avatar
Douwe Maan committed
360 361 362
  end

  add_index "ci_triggers", ["deleted_at"], name: "index_ci_triggers_on_deleted_at", using: :btree
363
  add_index "ci_triggers", ["gl_project_id"], name: "index_ci_triggers_on_gl_project_id", using: :btree
Douwe Maan's avatar
Douwe Maan committed
364

Valery Sizov's avatar
Valery Sizov committed
365
  create_table "ci_variables", force: :cascade do |t|
366
    t.integer "project_id"
367
    t.string  "key"
Douwe Maan's avatar
Douwe Maan committed
368 369
    t.text    "value"
    t.text    "encrypted_value"
370 371
    t.string  "encrypted_value_salt"
    t.string  "encrypted_value_iv"
372
    t.integer "gl_project_id"
Douwe Maan's avatar
Douwe Maan committed
373 374
  end

375
  add_index "ci_variables", ["gl_project_id"], name: "index_ci_variables_on_gl_project_id", using: :btree
Douwe Maan's avatar
Douwe Maan committed
376

Valery Sizov's avatar
Valery Sizov committed
377
  create_table "ci_web_hooks", force: :cascade do |t|
378 379
    t.string   "url",        null: false
    t.integer  "project_id", null: false
Douwe Maan's avatar
Douwe Maan committed
380 381 382 383
    t.datetime "created_at"
    t.datetime "updated_at"
  end

Valery Sizov's avatar
Valery Sizov committed
384
  create_table "deploy_keys_projects", force: :cascade do |t|
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
385 386
    t.integer  "deploy_key_id", null: false
    t.integer  "project_id",    null: false
387 388
    t.datetime "created_at"
    t.datetime "updated_at"
389
  end
390

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
391
  add_index "deploy_keys_projects", ["project_id"], name: "index_deploy_keys_projects_on_project_id", using: :btree
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
392

393
  create_table "deployments", force: :cascade do |t|
Kamil Trzcinski's avatar
Kamil Trzcinski committed
394
    t.integer  "iid",             null: false
395 396
    t.integer  "project_id",      null: false
    t.integer  "environment_id",  null: false
Kamil Trzcinski's avatar
Kamil Trzcinski committed
397 398 399
    t.string   "ref",             null: false
    t.boolean  "tag",             null: false
    t.string   "sha",             null: false
400
    t.integer  "user_id"
401 402
    t.integer  "deployable_id"
    t.string   "deployable_type"
403 404 405 406 407 408
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "deployments", ["project_id", "environment_id", "iid"], name: "index_deployments_on_project_id_and_environment_id_and_iid", using: :btree
  add_index "deployments", ["project_id", "environment_id"], name: "index_deployments_on_project_id_and_environment_id", using: :btree
409
  add_index "deployments", ["project_id", "iid"], name: "index_deployments_on_project_id_and_iid", unique: true, using: :btree
410 411
  add_index "deployments", ["project_id"], name: "index_deployments_on_project_id", using: :btree

Valery Sizov's avatar
Valery Sizov committed
412
  create_table "emails", force: :cascade do |t|
413 414
    t.integer  "user_id",    null: false
    t.string   "email",      null: false
415 416 417 418 419 420 421
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "emails", ["email"], name: "index_emails_on_email", unique: true, using: :btree
  add_index "emails", ["user_id"], name: "index_emails_on_user_id", using: :btree

422
  create_table "environments", force: :cascade do |t|
423
    t.integer  "project_id"
424 425 426 427 428 429 430
    t.string   "name",       null: false
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "environments", ["project_id", "name"], name: "index_environments_on_project_id_and_name", using: :btree

Valery Sizov's avatar
Valery Sizov committed
431
  create_table "events", force: :cascade do |t|
432
    t.string   "target_type"
Andrew8xx8's avatar
Andrew8xx8 committed
433
    t.integer  "target_id"
434
    t.string   "title"
Andrew8xx8's avatar
Andrew8xx8 committed
435 436
    t.text     "data"
    t.integer  "project_id"
437 438
    t.datetime "created_at"
    t.datetime "updated_at"
Andrew8xx8's avatar
Andrew8xx8 committed
439 440 441 442
    t.integer  "action"
    t.integer  "author_id"
  end

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
443 444 445 446 447 448 449
  add_index "events", ["action"], name: "index_events_on_action", using: :btree
  add_index "events", ["author_id"], name: "index_events_on_author_id", using: :btree
  add_index "events", ["created_at"], name: "index_events_on_created_at", using: :btree
  add_index "events", ["project_id"], name: "index_events_on_project_id", using: :btree
  add_index "events", ["target_id"], name: "index_events_on_target_id", using: :btree
  add_index "events", ["target_type"], name: "index_events_on_target_type", using: :btree

Valery Sizov's avatar
Valery Sizov committed
450
  create_table "forked_project_links", force: :cascade do |t|
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
451 452
    t.integer  "forked_to_project_id",   null: false
    t.integer  "forked_from_project_id", null: false
453 454
    t.datetime "created_at"
    t.datetime "updated_at"
455 456
  end

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
457
  add_index "forked_project_links", ["forked_to_project_id"], name: "index_forked_project_links_on_forked_to_project_id", unique: true, using: :btree
458

Valery Sizov's avatar
Valery Sizov committed
459
  create_table "identities", force: :cascade do |t|
460 461
    t.string   "extern_uid"
    t.string   "provider"
462 463 464
    t.integer  "user_id"
    t.datetime "created_at"
    t.datetime "updated_at"
465 466
  end

467
  add_index "identities", ["created_at", "id"], name: "index_identities_on_created_at_and_id", using: :btree
468 469
  add_index "identities", ["user_id"], name: "index_identities_on_user_id", using: :btree

Valery Sizov's avatar
Valery Sizov committed
470
  create_table "issues", force: :cascade do |t|
471
    t.string   "title"
Andrew8xx8's avatar
Andrew8xx8 committed
472 473 474
    t.integer  "assignee_id"
    t.integer  "author_id"
    t.integer  "project_id"
475 476
    t.datetime "created_at"
    t.datetime "updated_at"
477 478
    t.integer  "position",      default: 0
    t.string   "branch_name"
Andrew8xx8's avatar
Andrew8xx8 committed
479 480
    t.text     "description"
    t.integer  "milestone_id"
481
    t.string   "state"
482
    t.integer  "iid"
483
    t.integer  "updated_by_id"
484
    t.integer  "moved_to_id"
James Lopez's avatar
James Lopez committed
485
    t.boolean  "confidential",  default: false
486
    t.datetime "deleted_at"
487
    t.date     "due_date"
488
    t.integer  "lock_version",  default: 0,     null: false
Andrew8xx8's avatar
Andrew8xx8 committed
489 490
  end

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
491 492
  add_index "issues", ["assignee_id"], name: "index_issues_on_assignee_id", using: :btree
  add_index "issues", ["author_id"], name: "index_issues_on_author_id", using: :btree
493
  add_index "issues", ["confidential"], name: "index_issues_on_confidential", using: :btree
494
  add_index "issues", ["created_at", "id"], name: "index_issues_on_created_at_and_id", using: :btree
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
495
  add_index "issues", ["created_at"], name: "index_issues_on_created_at", using: :btree
Zeger-Jan van de Weg's avatar
Zeger-Jan van de Weg committed
496
  add_index "issues", ["deleted_at"], name: "index_issues_on_deleted_at", using: :btree
497
  add_index "issues", ["description"], name: "index_issues_on_description_trigram", using: :gin, opclasses: {"description"=>"gin_trgm_ops"}
498
  add_index "issues", ["due_date"], name: "index_issues_on_due_date", using: :btree
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
499
  add_index "issues", ["milestone_id"], name: "index_issues_on_milestone_id", using: :btree
500
  add_index "issues", ["project_id", "iid"], name: "index_issues_on_project_id_and_iid", unique: true, using: :btree
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
501
  add_index "issues", ["project_id"], name: "index_issues_on_project_id", using: :btree
502
  add_index "issues", ["state"], name: "index_issues_on_state", using: :btree
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
503
  add_index "issues", ["title"], name: "index_issues_on_title", using: :btree
504
  add_index "issues", ["title"], name: "index_issues_on_title_trigram", using: :gin, opclasses: {"title"=>"gin_trgm_ops"}
Andrew8xx8's avatar
Andrew8xx8 committed
505

Valery Sizov's avatar
Valery Sizov committed
506
  create_table "keys", force: :cascade do |t|
Andrew8xx8's avatar
Andrew8xx8 committed
507
    t.integer  "user_id"
508 509
    t.datetime "created_at"
    t.datetime "updated_at"
Andrew8xx8's avatar
Andrew8xx8 committed
510
    t.text     "key"
511 512 513 514
    t.string   "title"
    t.string   "type"
    t.string   "fingerprint"
    t.boolean  "public",      default: false, null: false
Andrew8xx8's avatar
Andrew8xx8 committed
515 516
  end

517
  add_index "keys", ["created_at", "id"], name: "index_keys_on_created_at_and_id", using: :btree
518
  add_index "keys", ["fingerprint"], name: "index_keys_on_fingerprint", unique: true, using: :btree
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
519
  add_index "keys", ["user_id"], name: "index_keys_on_user_id", using: :btree
Andrew8xx8's avatar
Andrew8xx8 committed
520

Valery Sizov's avatar
Valery Sizov committed
521
  create_table "label_links", force: :cascade do |t|
522 523
    t.integer  "label_id"
    t.integer  "target_id"
524
    t.string   "target_type"
525 526 527 528
    t.datetime "created_at"
    t.datetime "updated_at"
  end

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
529 530 531
  add_index "label_links", ["label_id"], name: "index_label_links_on_label_id", using: :btree
  add_index "label_links", ["target_id", "target_type"], name: "index_label_links_on_target_id_and_target_type", using: :btree

Valery Sizov's avatar
Valery Sizov committed
532
  create_table "labels", force: :cascade do |t|
533 534
    t.string   "title"
    t.string   "color"
535 536 537
    t.integer  "project_id"
    t.datetime "created_at"
    t.datetime "updated_at"
Tap's avatar
Tap committed
538 539
    t.boolean  "template",    default: false
    t.string   "description"
Thijs Wouters's avatar
Thijs Wouters committed
540
    t.integer  "priority"
541 542
  end

Thijs Wouters's avatar
Thijs Wouters committed
543
  add_index "labels", ["priority"], name: "index_labels_on_priority", using: :btree
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
544 545
  add_index "labels", ["project_id"], name: "index_labels_on_project_id", using: :btree

Valery Sizov's avatar
Valery Sizov committed
546
  create_table "lfs_objects", force: :cascade do |t|
547 548
    t.string   "oid",                  null: false
    t.integer  "size",       limit: 8, null: false
Marin Jankovski's avatar
Marin Jankovski committed
549 550
    t.datetime "created_at"
    t.datetime "updated_at"
551
    t.string   "file"
Marin Jankovski's avatar
Marin Jankovski committed
552 553
  end

554
  add_index "lfs_objects", ["oid"], name: "index_lfs_objects_on_oid", unique: true, using: :btree
Marin Jankovski's avatar
Marin Jankovski committed
555

Valery Sizov's avatar
Valery Sizov committed
556
  create_table "lfs_objects_projects", force: :cascade do |t|
Marin Jankovski's avatar
Marin Jankovski committed
557 558 559 560 561 562 563 564
    t.integer  "lfs_object_id", null: false
    t.integer  "project_id",    null: false
    t.datetime "created_at"
    t.datetime "updated_at"
  end

  add_index "lfs_objects_projects", ["project_id"], name: "index_lfs_objects_projects_on_project_id", using: :btree

Valery Sizov's avatar
Valery Sizov committed
565
  create_table "members", force: :cascade do |t|
566 567 568
    t.integer  "access_level",       null: false
    t.integer  "source_id",          null: false
    t.string   "source_type",        null: false
Douwe Maan's avatar
Douwe Maan committed
569
    t.integer  "user_id"
570 571
    t.integer  "notification_level", null: false
    t.string   "type"
572 573
    t.datetime "created_at"
    t.datetime "updated_at"
Douwe Maan's avatar
Douwe Maan committed
574
    t.integer  "created_by_id"
575 576
    t.string   "invite_email"
    t.string   "invite_token"
Douwe Maan's avatar
Douwe Maan committed
577
    t.datetime "invite_accepted_at"
Rémy Coutable's avatar
Rémy Coutable committed
578
    t.datetime "requested_at"
579 580
  end

581
  add_index "members", ["access_level"], name: "index_members_on_access_level", using: :btree
582
  add_index "members", ["created_at", "id"], name: "index_members_on_created_at_and_id", using: :btree
Douwe Maan's avatar
Douwe Maan committed
583
  add_index "members", ["invite_token"], name: "index_members_on_invite_token", unique: true, using: :btree
584
  add_index "members", ["requested_at"], name: "index_members_on_requested_at", using: :btree
585 586 587 588
  add_index "members", ["source_id", "source_type"], name: "index_members_on_source_id_and_source_type", using: :btree
  add_index "members", ["type"], name: "index_members_on_type", using: :btree
  add_index "members", ["user_id"], name: "index_members_on_user_id", using: :btree

Valery Sizov's avatar
Valery Sizov committed
589
  create_table "merge_request_diffs", force: :cascade do |t|
590
    t.string   "state"
Kamil Trzcinski's avatar
Kamil Trzcinski committed
591 592
    t.text     "st_commits"
    t.text     "st_diffs"
593
    t.integer  "merge_request_id", null: false
594 595
    t.datetime "created_at"
    t.datetime "updated_at"
596
    t.string   "base_commit_sha"
597
    t.string   "real_size"
Douwe Maan's avatar
Douwe Maan committed
598 599
    t.string   "head_commit_sha"
    t.string   "start_commit_sha"
600 601
  end

602 603
  add_index "merge_request_diffs", ["merge_request_id"], name: "index_merge_request_diffs_on_merge_request_id", unique: true, using: :btree

Valery Sizov's avatar
Valery Sizov committed
604
  create_table "merge_requests", force: :cascade do |t|
605 606 607
    t.string   "target_branch",                             null: false
    t.string   "source_branch",                             null: false
    t.integer  "source_project_id",                         null: false
Andrew8xx8's avatar
Andrew8xx8 committed
608 609
    t.integer  "author_id"
    t.integer  "assignee_id"
610
    t.string   "title"
611 612
    t.datetime "created_at"
    t.datetime "updated_at"
Andrew8xx8's avatar
Andrew8xx8 committed
613
    t.integer  "milestone_id"
614 615 616
    t.string   "state"
    t.string   "merge_status"
    t.integer  "target_project_id",                         null: false
617
    t.integer  "iid"
618
    t.text     "description"
619
    t.integer  "position",                  default: 0
620
    t.datetime "locked_at"
621
    t.integer  "updated_by_id"
622
    t.string   "merge_error"
Zeger-Jan van de Weg's avatar
Zeger-Jan van de Weg committed
623
    t.text     "merge_params"
624
    t.boolean  "merge_when_build_succeeds", default: false, null: false
Zeger-Jan van de Weg's avatar
Zeger-Jan van de Weg committed
625
    t.integer  "merge_user_id"
626
    t.string   "merge_commit_sha"
Zeger-Jan van de Weg's avatar
Zeger-Jan van de Weg committed
627
    t.datetime "deleted_at"
628
    t.integer  "lock_version",              default: 0,     null: false
Andrew8xx8's avatar
Andrew8xx8 committed
629 630
  end

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
631 632
  add_index "merge_requests", ["assignee_id"], name: "index_merge_requests_on_assignee_id", using: :btree
  add_index "merge_requests", ["author_id"], name: "index_merge_requests_on_author_id", using: :btree
633
  add_index "merge_requests", ["created_at", "id"], name: "index_merge_requests_on_created_at_and_id", using: :btree
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
634
  add_index "merge_requests", ["created_at"], name: "index_merge_requests_on_created_at", using: :btree
Zeger-Jan van de Weg's avatar
Zeger-Jan van de Weg committed
635
  add_index "merge_requests", ["deleted_at"], name: "index_merge_requests_on_deleted_at", using: :btree
636
  add_index "merge_requests", ["description"], name: "index_merge_requests_on_description_trigram", using: :gin, opclasses: {"description"=>"gin_trgm_ops"}
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
637 638
  add_index "merge_requests", ["milestone_id"], name: "index_merge_requests_on_milestone_id", using: :btree
  add_index "merge_requests", ["source_branch"], name: "index_merge_requests_on_source_branch", using: :btree
639
  add_index "merge_requests", ["source_project_id"], name: "index_merge_requests_on_source_project_id", using: :btree
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
640
  add_index "merge_requests", ["target_branch"], name: "index_merge_requests_on_target_branch", using: :btree
641
  add_index "merge_requests", ["target_project_id", "iid"], name: "index_merge_requests_on_target_project_id_and_iid", unique: true, using: :btree
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
642
  add_index "merge_requests", ["title"], name: "index_merge_requests_on_title", using: :btree
643
  add_index "merge_requests", ["title"], name: "index_merge_requests_on_title_trigram", using: :gin, opclasses: {"title"=>"gin_trgm_ops"}
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
644

Valery Sizov's avatar
Valery Sizov committed
645
  create_table "milestones", force: :cascade do |t|
646 647
    t.string   "title",       null: false
    t.integer  "project_id",  null: false
Andrew8xx8's avatar
Andrew8xx8 committed
648 649
    t.text     "description"
    t.date     "due_date"
650 651
    t.datetime "created_at"
    t.datetime "updated_at"
652
    t.string   "state"
653
    t.integer  "iid"
Andrew8xx8's avatar
Andrew8xx8 committed
654 655
  end

656
  add_index "milestones", ["created_at", "id"], name: "index_milestones_on_created_at_and_id", using: :btree
657
  add_index "milestones", ["description"], name: "index_milestones_on_description_trigram", using: :gin, opclasses: {"description"=>"gin_trgm_ops"}
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
658
  add_index "milestones", ["due_date"], name: "index_milestones_on_due_date", using: :btree
659
  add_index "milestones", ["project_id", "iid"], name: "index_milestones_on_project_id_and_iid", unique: true, using: :btree
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
660
  add_index "milestones", ["project_id"], name: "index_milestones_on_project_id", using: :btree
661
  add_index "milestones", ["title"], name: "index_milestones_on_title", using: :btree
662
  add_index "milestones", ["title"], name: "index_milestones_on_title_trigram", using: :gin, opclasses: {"title"=>"gin_trgm_ops"}
Andrew8xx8's avatar
Andrew8xx8 committed
663

Valery Sizov's avatar
Valery Sizov committed
664
  create_table "namespaces", force: :cascade do |t|
665 666
    t.string   "name",                                  null: false
    t.string   "path",                                  null: false
667
    t.integer  "owner_id"
668 669
    t.datetime "created_at"
    t.datetime "updated_at"
670
    t.string   "type"
671
    t.string   "description",           default: "",    null: false
672
    t.string   "avatar"
673
    t.boolean  "share_with_group_lock", default: false
Douwe Maan's avatar
Douwe Maan committed
674
    t.integer  "visibility_level",      default: 20,    null: false
Andrew8xx8's avatar
Andrew8xx8 committed
675 676
  end

677
  add_index "namespaces", ["created_at", "id"], name: "index_namespaces_on_created_at_and_id", using: :btree
678
  add_index "namespaces", ["name"], name: "index_namespaces_on_name", unique: true, using: :btree
679
  add_index "namespaces", ["name"], name: "index_namespaces_on_name_trigram", using: :gin, opclasses: {"name"=>"gin_trgm_ops"}
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
680
  add_index "namespaces", ["owner_id"], name: "index_namespaces_on_owner_id", using: :btree
Valery Sizov's avatar
Valery Sizov committed
681
  add_index "namespaces", ["path"], name: "index_namespaces_on_path", unique: true, using: :btree
682
  add_index "namespaces", ["path"], name: "index_namespaces_on_path_trigram", using: :gin, opclasses: {"path"=>"gin_trgm_ops"}
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
683
  add_index "namespaces", ["type"], name: "index_namespaces_on_type", using: :btree
Douwe Maan's avatar
Douwe Maan committed
684
  add_index "namespaces", ["visibility_level"], name: "index_namespaces_on_visibility_level", using: :btree
Andrew8xx8's avatar
Andrew8xx8 committed
685

Valery Sizov's avatar
Valery Sizov committed
686
  create_table "notes", force: :cascade do |t|
Andrew8xx8's avatar
Andrew8xx8 committed
687
    t.text     "note"
688
    t.string   "noteable_type"
Andrew8xx8's avatar
Andrew8xx8 committed
689
    t.integer  "author_id"
690 691
    t.datetime "created_at"
    t.datetime "updated_at"
Andrew8xx8's avatar
Andrew8xx8 committed
692
    t.integer  "project_id"
693 694 695
    t.string   "attachment"
    t.string   "line_code"
    t.string   "commit_id"
Andrew8xx8's avatar
Andrew8xx8 committed
696
    t.integer  "noteable_id"
Douwe Maan's avatar
Douwe Maan committed
697
    t.boolean  "system",            default: false, null: false
Kamil Trzcinski's avatar
Kamil Trzcinski committed
698
    t.text     "st_diff"
699
    t.integer  "updated_by_id"
700
    t.string   "type"
Douwe Maan's avatar
Douwe Maan committed
701 702
    t.text     "position"
    t.text     "original_position"
Andrew8xx8's avatar
Andrew8xx8 committed
703 704
  end

Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
705 706
  add_index "notes", ["author_id"], name: "index_notes_on_author_id", using: :btree
  add_index "notes", ["commit_id"], name: "index_notes_on_commit_id", using: :btree
707
  add_index "notes", ["created_at", "id"], name: "index_notes_on_created_at_and_id", using: :btree
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
708
  add_index "notes", ["created_at"], name: "index_notes_on_created_at", using: :btree
709
  add_index "notes", ["line_code"], name: "index_notes_on_line_code", using: :btree
710
  add_index "notes", ["note"], name: "index_notes_on_note_trigram", using: :gin, opclasses: {"note"=>"gin_trgm_ops"}
Dmitriy Zaporozhets's avatar
Dmitriy Zaporozhets committed
711 712 713 714
  add_index "notes", ["noteable_id", "noteable_type"], name: "index_notes_on_noteable_id_and_noteable_type", using: :btree
  add_index "notes", ["noteable_type"], name: "index_notes_on_noteable_type", using: :btree
  add_index "notes", ["project_id", "noteable_type"], name: "index_notes_on_project_id_and_noteable_type", using: :btree
  add_index "notes", ["project_id"], name: "index_notes_on_project_id", using: :btree
715
  add_index "notes", ["updated_at"], name: "index_notes_on_updated_at", using: :btree
Andrew8xx8's avatar
Andrew8xx8 committed
716

717
  create_table "notification_settings", force: :cascade do |t|
718
    t.integer  "user_id",                 null: false
719 720
    t.integer  "source_id"
    t.string   "source_type"
721 722 723
    t.integer  "level",       default: 0, null: false
    t.datetime "created_at",              null: false
    t.datetime "updated_at",              null: false
724
    t.text     "events"
725 726
  end

727
  add_index "notification_settings", ["source_id", "source_type"], name: "index_notification_settings_on_source_id_and_source_type"