diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-08-17 12:15:38 +0300 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-08-17 12:15:38 +0300 |
commit | 5caf10664a064d73b490232399afb054f3d82ee5 (patch) | |
tree | 120135f5e2fb051e21d57a7ccde4a4d8cd784a20 /db | |
parent | f52f62d7aec168b3b8c291cdb81f64501bd80e5a (diff) | |
parent | d1da2e8180d92e5f4a8b5ebb36b0f4e4d0618bf8 (diff) |
Merge remote-tracking branch 'origin/master' into 18141-pipeline-graph
Diffstat (limited to 'db')
-rw-r--r-- | db/fixtures/development/14_builds.rb | 59 | ||||
-rw-r--r-- | db/migrate/20140407135544_fix_namespaces.rb | 10 | ||||
-rw-r--r-- | db/migrate/20160716115711_add_queued_at_to_ci_builds.rb | 9 | ||||
-rw-r--r-- | db/migrate/20160727163552_create_user_agent_details.rb | 18 | ||||
-rw-r--r-- | db/migrate/20160728081025_add_pipeline_events_to_web_hooks.rb | 16 | ||||
-rw-r--r-- | db/migrate/20160728103734_add_pipeline_events_to_services.rb | 16 | ||||
-rw-r--r-- | db/migrate/20160729173930_remove_project_id_from_spam_logs.rb | 29 | ||||
-rw-r--r-- | db/migrate/20160801163709_add_submitted_as_ham_to_spam_logs.rb | 20 | ||||
-rw-r--r-- | db/migrate/20160805041956_add_deleted_at_to_namespaces.rb | 12 | ||||
-rw-r--r-- | db/migrate/20160810102349_remove_ci_runner_trigram_indexes.rb | 27 | ||||
-rw-r--r-- | db/migrate/20160810142633_remove_redundant_indexes.rb | 112 | ||||
-rw-r--r-- | db/schema.rb | 77 |
12 files changed, 317 insertions, 88 deletions
diff --git a/db/fixtures/development/14_builds.rb b/db/fixtures/development/14_builds.rb index 3734c861078..0d493fa1c3c 100644 --- a/db/fixtures/development/14_builds.rb +++ b/db/fixtures/development/14_builds.rb @@ -1,5 +1,21 @@ class Gitlab::Seeder::Builds STAGES = %w[build notify_build test notify_test deploy notify_deploy] + BUILDS = [ + { name: 'build:linux', stage: 'build', status: :success }, + { name: 'build:osx', stage: 'build', status: :success }, + { name: 'slack post build', stage: 'notify_build', status: :success }, + { name: 'rspec:linux', stage: 'test', status: :success }, + { name: 'rspec:windows', stage: 'test', status: :success }, + { name: 'rspec:windows', stage: 'test', status: :success }, + { name: 'rspec:osx', stage: 'test', status_event: :success }, + { name: 'spinach:linux', stage: 'test', status: :pending }, + { name: 'spinach:osx', stage: 'test', status: :canceled }, + { name: 'cucumber:linux', stage: 'test', status: :running }, + { name: 'cucumber:osx', stage: 'test', status: :failed }, + { name: 'slack post test', stage: 'notify_test', status: :success }, + { name: 'staging', stage: 'deploy', environment: 'staging', status: :success }, + { name: 'production', stage: 'deploy', environment: 'production', when: 'manual', status: :success }, + ] def initialize(project) @project = project @@ -8,25 +24,7 @@ class Gitlab::Seeder::Builds def seed! pipelines.each do |pipeline| begin - build_create!(pipeline, name: 'build:linux', stage: 'build', status_event: :success) - build_create!(pipeline, name: 'build:osx', stage: 'build', status_event: :success) - - build_create!(pipeline, name: 'slack post build', stage: 'notify_build', status_event: :success) - - build_create!(pipeline, name: 'rspec:linux', stage: 'test', status_event: :success) - build_create!(pipeline, name: 'rspec:windows', stage: 'test', status_event: :success) - build_create!(pipeline, name: 'rspec:windows', stage: 'test', status_event: :success) - build_create!(pipeline, name: 'rspec:osx', stage: 'test', status_event: :success) - build_create!(pipeline, name: 'spinach:linux', stage: 'test', status: :pending) - build_create!(pipeline, name: 'spinach:osx', stage: 'test', status_event: :cancel) - build_create!(pipeline, name: 'cucumber:linux', stage: 'test', status_event: :run) - build_create!(pipeline, name: 'cucumber:osx', stage: 'test', status_event: :drop) - - build_create!(pipeline, name: 'slack post test', stage: 'notify_test', status_event: :success) - - build_create!(pipeline, name: 'staging', stage: 'deploy', environment: 'staging', status_event: :success) - build_create!(pipeline, name: 'production', stage: 'deploy', environment: 'production', when: 'manual', status: :success) - + BUILDS.each { |opts| build_create!(pipeline, opts) } commit_status_create!(pipeline, name: 'jenkins', status: :success) print '.' rescue ActiveRecord::RecordInvalid @@ -68,21 +66,22 @@ class Gitlab::Seeder::Builds def build_create!(pipeline, opts = {}) attributes = build_attributes_for(pipeline, opts) - build = Ci::Build.create!(attributes) - if opts[:name].start_with?('build') - artifacts_cache_file(artifacts_archive_path) do |file| - build.artifacts_file = file - end + Ci::Build.create!(attributes) do |build| + if opts[:name].start_with?('build') + artifacts_cache_file(artifacts_archive_path) do |file| + build.artifacts_file = file + end - artifacts_cache_file(artifacts_metadata_path) do |file| - build.artifacts_metadata = file + artifacts_cache_file(artifacts_metadata_path) do |file| + build.artifacts_metadata = file + end end - end - if %w(running success failed).include?(build.status) - # We need to set build trace after saving a build (id required) - build.trace = FFaker::Lorem.paragraphs(6).join("\n\n") + if %w(running success failed).include?(build.status) + # We need to set build trace after saving a build (id required) + build.trace = FFaker::Lorem.paragraphs(6).join("\n\n") + end end end diff --git a/db/migrate/20140407135544_fix_namespaces.rb b/db/migrate/20140407135544_fix_namespaces.rb index 91374966698..0026ce645a6 100644 --- a/db/migrate/20140407135544_fix_namespaces.rb +++ b/db/migrate/20140407135544_fix_namespaces.rb @@ -1,8 +1,14 @@ # rubocop:disable all class FixNamespaces < ActiveRecord::Migration + DOWNTIME = false + def up - Namespace.where('name <> path and type is null').each do |namespace| - namespace.update_attribute(:name, namespace.path) + namespaces = exec_query('SELECT id, path FROM namespaces WHERE name <> path and type is null') + + namespaces.each do |row| + id = row['id'] + path = row['path'] + exec_query("UPDATE namespaces SET name = '#{path}' WHERE id = #{id}") end end diff --git a/db/migrate/20160716115711_add_queued_at_to_ci_builds.rb b/db/migrate/20160716115711_add_queued_at_to_ci_builds.rb new file mode 100644 index 00000000000..756910a1fa0 --- /dev/null +++ b/db/migrate/20160716115711_add_queued_at_to_ci_builds.rb @@ -0,0 +1,9 @@ +class AddQueuedAtToCiBuilds < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + add_column :ci_builds, :queued_at, :timestamp + end +end diff --git a/db/migrate/20160727163552_create_user_agent_details.rb b/db/migrate/20160727163552_create_user_agent_details.rb new file mode 100644 index 00000000000..ed4ccfedc0a --- /dev/null +++ b/db/migrate/20160727163552_create_user_agent_details.rb @@ -0,0 +1,18 @@ +class CreateUserAgentDetails < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + def change + create_table :user_agent_details do |t| + t.string :user_agent, null: false + t.string :ip_address, null: false + t.integer :subject_id, null: false + t.string :subject_type, null: false + t.boolean :submitted, default: false, null: false + + t.timestamps null: false + end + end +end diff --git a/db/migrate/20160728081025_add_pipeline_events_to_web_hooks.rb b/db/migrate/20160728081025_add_pipeline_events_to_web_hooks.rb new file mode 100644 index 00000000000..b800e6d7283 --- /dev/null +++ b/db/migrate/20160728081025_add_pipeline_events_to_web_hooks.rb @@ -0,0 +1,16 @@ +class AddPipelineEventsToWebHooks < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_column_with_default(:web_hooks, :pipeline_events, :boolean, + default: false, allow_null: false) + end + + def down + remove_column(:web_hooks, :pipeline_events) + end +end diff --git a/db/migrate/20160728103734_add_pipeline_events_to_services.rb b/db/migrate/20160728103734_add_pipeline_events_to_services.rb new file mode 100644 index 00000000000..bcd24fe1566 --- /dev/null +++ b/db/migrate/20160728103734_add_pipeline_events_to_services.rb @@ -0,0 +1,16 @@ +class AddPipelineEventsToServices < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_column_with_default(:services, :pipeline_events, :boolean, + default: false, allow_null: false) + end + + def down + remove_column(:services, :pipeline_events) + end +end diff --git a/db/migrate/20160729173930_remove_project_id_from_spam_logs.rb b/db/migrate/20160729173930_remove_project_id_from_spam_logs.rb new file mode 100644 index 00000000000..e28ab31d629 --- /dev/null +++ b/db/migrate/20160729173930_remove_project_id_from_spam_logs.rb @@ -0,0 +1,29 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class RemoveProjectIdFromSpamLogs < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = true + + # When a migration requires downtime you **must** uncomment the following + # constant and define a short and easy to understand explanation as to why the + # migration requires downtime. + DOWNTIME_REASON = 'Removing a column that contains data that is not used anywhere.' + + # When using the methods "add_concurrent_index" or "add_column_with_default" + # you must disable the use of transactions as these methods can not run in an + # existing transaction. When using "add_concurrent_index" make sure that this + # method is the _only_ method called in the migration, any other changes + # should go in a separate migration. This ensures that upon failure _only_ the + # index creation fails and can be retried or reverted easily. + # + # To disable transactions uncomment the following line and remove these + # comments: + # disable_ddl_transaction! + + def change + remove_column :spam_logs, :project_id, :integer + end +end diff --git a/db/migrate/20160801163709_add_submitted_as_ham_to_spam_logs.rb b/db/migrate/20160801163709_add_submitted_as_ham_to_spam_logs.rb new file mode 100644 index 00000000000..296f1dfac7b --- /dev/null +++ b/db/migrate/20160801163709_add_submitted_as_ham_to_spam_logs.rb @@ -0,0 +1,20 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class AddSubmittedAsHamToSpamLogs < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + # Set this constant to true if this migration requires downtime. + DOWNTIME = false + + # When a migration requires downtime you **must** uncomment the following + # constant and define a short and easy to understand explanation as to why the + # migration requires downtime. + # DOWNTIME_REASON = '' + + disable_ddl_transaction! + + def change + add_column_with_default :spam_logs, :submitted_as_ham, :boolean, default: false + end +end diff --git a/db/migrate/20160805041956_add_deleted_at_to_namespaces.rb b/db/migrate/20160805041956_add_deleted_at_to_namespaces.rb new file mode 100644 index 00000000000..a853de3abfb --- /dev/null +++ b/db/migrate/20160805041956_add_deleted_at_to_namespaces.rb @@ -0,0 +1,12 @@ +class AddDeletedAtToNamespaces < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def change + add_column :namespaces, :deleted_at, :datetime + add_concurrent_index :namespaces, :deleted_at + end +end diff --git a/db/migrate/20160810102349_remove_ci_runner_trigram_indexes.rb b/db/migrate/20160810102349_remove_ci_runner_trigram_indexes.rb new file mode 100644 index 00000000000..0cfb637804b --- /dev/null +++ b/db/migrate/20160810102349_remove_ci_runner_trigram_indexes.rb @@ -0,0 +1,27 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class RemoveCiRunnerTrigramIndexes < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + # Disabled for the "down" method so the indexes can be re-created concurrently. + disable_ddl_transaction! + + def up + return unless Gitlab::Database.postgresql? + + transaction do + execute 'DROP INDEX IF EXISTS index_ci_runners_on_token_trigram;' + execute 'DROP INDEX IF EXISTS index_ci_runners_on_description_trigram;' + end + end + + def down + return unless Gitlab::Database.postgresql? + + execute 'CREATE INDEX CONCURRENTLY index_ci_runners_on_token_trigram ON ci_runners USING gin(token gin_trgm_ops);' + execute 'CREATE INDEX CONCURRENTLY index_ci_runners_on_description_trigram ON ci_runners USING gin(description gin_trgm_ops);' + end +end diff --git a/db/migrate/20160810142633_remove_redundant_indexes.rb b/db/migrate/20160810142633_remove_redundant_indexes.rb new file mode 100644 index 00000000000..8641c6ffa8f --- /dev/null +++ b/db/migrate/20160810142633_remove_redundant_indexes.rb @@ -0,0 +1,112 @@ +# See http://doc.gitlab.com/ce/development/migration_style_guide.html +# for more information on how to write migrations for GitLab. + +class RemoveRedundantIndexes < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + indexes = [ + [:ci_taggings, 'ci_taggings_idx'], + [:audit_events, 'index_audit_events_on_author_id'], + [:audit_events, 'index_audit_events_on_type'], + [:ci_builds, 'index_ci_builds_on_erased_by_id'], + [:ci_builds, 'index_ci_builds_on_project_id_and_commit_id'], + [:ci_builds, 'index_ci_builds_on_type'], + [:ci_commits, 'index_ci_commits_on_project_id'], + [:ci_commits, 'index_ci_commits_on_project_id_and_committed_at'], + [:ci_commits, 'index_ci_commits_on_project_id_and_committed_at_and_id'], + [:ci_commits, 'index_ci_commits_on_project_id_and_sha'], + [:ci_commits, 'index_ci_commits_on_sha'], + [:ci_events, 'index_ci_events_on_created_at'], + [:ci_events, 'index_ci_events_on_is_admin'], + [:ci_events, 'index_ci_events_on_project_id'], + [:ci_jobs, 'index_ci_jobs_on_deleted_at'], + [:ci_jobs, 'index_ci_jobs_on_project_id'], + [:ci_projects, 'index_ci_projects_on_gitlab_id'], + [:ci_projects, 'index_ci_projects_on_shared_runners_enabled'], + [:ci_services, 'index_ci_services_on_project_id'], + [:ci_sessions, 'index_ci_sessions_on_session_id'], + [:ci_sessions, 'index_ci_sessions_on_updated_at'], + [:ci_tags, 'index_ci_tags_on_name'], + [:ci_triggers, 'index_ci_triggers_on_deleted_at'], + [:identities, 'index_identities_on_created_at_and_id'], + [:issues, 'index_issues_on_title'], + [:keys, 'index_keys_on_created_at_and_id'], + [:members, 'index_members_on_created_at_and_id'], + [:members, 'index_members_on_type'], + [:milestones, 'index_milestones_on_created_at_and_id'], + [:namespaces, 'index_namespaces_on_visibility_level'], + [:projects, 'index_projects_on_builds_enabled_and_shared_runners_enabled'], + [:services, 'index_services_on_category'], + [:services, 'index_services_on_created_at_and_id'], + [:services, 'index_services_on_default'], + [:snippets, 'index_snippets_on_created_at'], + [:snippets, 'index_snippets_on_created_at_and_id'], + [:todos, 'index_todos_on_state'], + [:web_hooks, 'index_web_hooks_on_created_at_and_id'], + + # These indexes _may_ be used but they can be replaced by other existing + # indexes. + + # There's already a composite index on (project_id, iid) which means that + # a separate index for _just_ project_id is not needed. + [:issues, 'index_issues_on_project_id'], + + # These are all composite indexes for the columns (created_at, id). In all + # these cases there's already a standalone index for "created_at" which + # can be used instead. + # + # Because the "id" column of these composite indexes is never needed (due + # to "id" already being indexed as its a primary key) these composite + # indexes are useless. + [:issues, 'index_issues_on_created_at_and_id'], + [:merge_requests, 'index_merge_requests_on_created_at_and_id'], + [:namespaces, 'index_namespaces_on_created_at_and_id'], + [:notes, 'index_notes_on_created_at_and_id'], + [:projects, 'index_projects_on_created_at_and_id'], + [:users, 'index_users_on_created_at_and_id'], + ] + + transaction do + indexes.each do |(table, index)| + remove_index(table, name: index) if index_exists_by_name?(table, index) + end + end + + add_concurrent_index(:users, :created_at) + add_concurrent_index(:projects, :created_at) + add_concurrent_index(:namespaces, :created_at) + end + + def down + # We're only restoring the composite indexes that could be replaced with + # individual ones, just in case somebody would ever want to revert. + transaction do + remove_index(:users, :created_at) + remove_index(:projects, :created_at) + remove_index(:namespaces, :created_at) + end + + [:issues, :merge_requests, :namespaces, :notes, :projects, :users].each do |table| + add_concurrent_index(table, [:created_at, :id], + name: "index_#{table}_on_created_at_and_id") + end + end + + # Rails' index_exists? doesn't work when you only give it a table and index + # name. As such we have to use some extra code to check if an index exists for + # a given name. + def index_exists_by_name?(table, index) + indexes_for_table[table].include?(index) + end + + def indexes_for_table + @indexes_for_table ||= Hash.new do |hash, table_name| + hash[table_name] = indexes(table_name).map(&:name) + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 71980a6d51f..445f484a8c7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20160804150737) do +ActiveRecord::Schema.define(version: 20160810142633) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -102,9 +102,7 @@ ActiveRecord::Schema.define(version: 20160804150737) do 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 create_table "award_emoji", force: :cascade do |t| t.string "name" @@ -172,6 +170,7 @@ ActiveRecord::Schema.define(version: 20160804150737) do t.integer "artifacts_size" t.string "when" t.text "yaml_variables" + t.datetime "queued_at" end 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 @@ -179,13 +178,10 @@ ActiveRecord::Schema.define(version: 20160804150737) do 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 add_index "ci_builds", ["commit_id"], name: "index_ci_builds_on_commit_id", using: :btree - add_index "ci_builds", ["erased_by_id"], name: "index_ci_builds_on_erased_by_id", using: :btree add_index "ci_builds", ["gl_project_id"], name: "index_ci_builds_on_gl_project_id", using: :btree - 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 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 create_table "ci_commits", force: :cascade do |t| t.integer "project_id" @@ -209,11 +205,6 @@ ActiveRecord::Schema.define(version: 20160804150737) do 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 add_index "ci_commits", ["gl_project_id"], name: "index_ci_commits_on_gl_project_id", using: :btree - add_index "ci_commits", ["project_id", "committed_at", "id"], name: "index_ci_commits_on_project_id_and_committed_at_and_id", using: :btree - 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 add_index "ci_commits", ["status"], name: "index_ci_commits_on_status", using: :btree add_index "ci_commits", ["user_id"], name: "index_ci_commits_on_user_id", using: :btree @@ -226,10 +217,6 @@ ActiveRecord::Schema.define(version: 20160804150737) do 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 - create_table "ci_jobs", force: :cascade do |t| t.integer "project_id", null: false t.text "commands" @@ -244,9 +231,6 @@ ActiveRecord::Schema.define(version: 20160804150737) do 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 - create_table "ci_projects", force: :cascade do |t| t.string "name" t.integer "timeout", default: 3600, null: false @@ -270,9 +254,6 @@ ActiveRecord::Schema.define(version: 20160804150737) do t.text "generated_yaml_config" end - 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 - create_table "ci_runner_projects", force: :cascade do |t| t.integer "runner_id", null: false t.integer "project_id" @@ -301,10 +282,8 @@ ActiveRecord::Schema.define(version: 20160804150737) do t.boolean "locked", default: false, null: false end - add_index "ci_runners", ["description"], name: "index_ci_runners_on_description_trigram", using: :gin, opclasses: {"description"=>"gin_trgm_ops"} add_index "ci_runners", ["locked"], name: "index_ci_runners_on_locked", using: :btree add_index "ci_runners", ["token"], name: "index_ci_runners_on_token", using: :btree - add_index "ci_runners", ["token"], name: "index_ci_runners_on_token_trigram", using: :gin, opclasses: {"token"=>"gin_trgm_ops"} create_table "ci_services", force: :cascade do |t| t.string "type" @@ -316,8 +295,6 @@ ActiveRecord::Schema.define(version: 20160804150737) do t.text "properties" end - add_index "ci_services", ["project_id"], name: "index_ci_services_on_project_id", using: :btree - create_table "ci_sessions", force: :cascade do |t| t.string "session_id", null: false t.text "data" @@ -325,9 +302,6 @@ ActiveRecord::Schema.define(version: 20160804150737) do 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 - create_table "ci_taggings", force: :cascade do |t| t.integer "tag_id" t.integer "taggable_id" @@ -338,7 +312,6 @@ ActiveRecord::Schema.define(version: 20160804150737) do 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 create_table "ci_tags", force: :cascade do |t| @@ -346,8 +319,6 @@ ActiveRecord::Schema.define(version: 20160804150737) do t.integer "taggings_count", default: 0 end - add_index "ci_tags", ["name"], name: "index_ci_tags_on_name", unique: true, using: :btree - create_table "ci_trigger_requests", force: :cascade do |t| t.integer "trigger_id", null: false t.text "variables" @@ -365,7 +336,6 @@ ActiveRecord::Schema.define(version: 20160804150737) do t.integer "gl_project_id" end - add_index "ci_triggers", ["deleted_at"], name: "index_ci_triggers_on_deleted_at", using: :btree add_index "ci_triggers", ["gl_project_id"], name: "index_ci_triggers_on_gl_project_id", using: :btree create_table "ci_variables", force: :cascade do |t| @@ -471,7 +441,6 @@ ActiveRecord::Schema.define(version: 20160804150737) do t.datetime "updated_at" end - add_index "identities", ["created_at", "id"], name: "index_identities_on_created_at_and_id", using: :btree add_index "identities", ["user_id"], name: "index_identities_on_user_id", using: :btree create_table "issues", force: :cascade do |t| @@ -497,16 +466,13 @@ ActiveRecord::Schema.define(version: 20160804150737) do 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 add_index "issues", ["confidential"], name: "index_issues_on_confidential", using: :btree - add_index "issues", ["created_at", "id"], name: "index_issues_on_created_at_and_id", using: :btree add_index "issues", ["created_at"], name: "index_issues_on_created_at", using: :btree add_index "issues", ["deleted_at"], name: "index_issues_on_deleted_at", using: :btree add_index "issues", ["description"], name: "index_issues_on_description_trigram", using: :gin, opclasses: {"description"=>"gin_trgm_ops"} add_index "issues", ["due_date"], name: "index_issues_on_due_date", using: :btree add_index "issues", ["milestone_id"], name: "index_issues_on_milestone_id", using: :btree add_index "issues", ["project_id", "iid"], name: "index_issues_on_project_id_and_iid", unique: true, using: :btree - add_index "issues", ["project_id"], name: "index_issues_on_project_id", using: :btree add_index "issues", ["state"], name: "index_issues_on_state", using: :btree - add_index "issues", ["title"], name: "index_issues_on_title", using: :btree add_index "issues", ["title"], name: "index_issues_on_title_trigram", using: :gin, opclasses: {"title"=>"gin_trgm_ops"} create_table "keys", force: :cascade do |t| @@ -520,7 +486,6 @@ ActiveRecord::Schema.define(version: 20160804150737) do t.boolean "public", default: false, null: false end - add_index "keys", ["created_at", "id"], name: "index_keys_on_created_at_and_id", using: :btree add_index "keys", ["fingerprint"], name: "index_keys_on_fingerprint", unique: true, using: :btree add_index "keys", ["user_id"], name: "index_keys_on_user_id", using: :btree @@ -585,11 +550,9 @@ ActiveRecord::Schema.define(version: 20160804150737) do end add_index "members", ["access_level"], name: "index_members_on_access_level", using: :btree - add_index "members", ["created_at", "id"], name: "index_members_on_created_at_and_id", using: :btree add_index "members", ["invite_token"], name: "index_members_on_invite_token", unique: true, using: :btree add_index "members", ["requested_at"], name: "index_members_on_requested_at", using: :btree 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 create_table "merge_request_diffs", force: :cascade do |t| @@ -626,17 +589,16 @@ ActiveRecord::Schema.define(version: 20160804150737) do t.datetime "locked_at" t.integer "updated_by_id" t.string "merge_error" - t.text "merge_params" t.boolean "merge_when_build_succeeds", default: false, null: false t.integer "merge_user_id" t.string "merge_commit_sha" t.datetime "deleted_at" t.string "in_progress_merge_commit_sha" + t.text "merge_params" end 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 - add_index "merge_requests", ["created_at", "id"], name: "index_merge_requests_on_created_at_and_id", using: :btree add_index "merge_requests", ["created_at"], name: "index_merge_requests_on_created_at", using: :btree add_index "merge_requests", ["deleted_at"], name: "index_merge_requests_on_deleted_at", using: :btree add_index "merge_requests", ["description"], name: "index_merge_requests_on_description_trigram", using: :gin, opclasses: {"description"=>"gin_trgm_ops"} @@ -659,7 +621,6 @@ ActiveRecord::Schema.define(version: 20160804150737) do t.integer "iid" end - add_index "milestones", ["created_at", "id"], name: "index_milestones_on_created_at_and_id", using: :btree add_index "milestones", ["description"], name: "index_milestones_on_description_trigram", using: :gin, opclasses: {"description"=>"gin_trgm_ops"} add_index "milestones", ["due_date"], name: "index_milestones_on_due_date", using: :btree add_index "milestones", ["project_id", "iid"], name: "index_milestones_on_project_id_and_iid", unique: true, using: :btree @@ -679,16 +640,17 @@ ActiveRecord::Schema.define(version: 20160804150737) do t.boolean "share_with_group_lock", default: false t.integer "visibility_level", default: 20, null: false t.boolean "request_access_enabled", default: true, null: false + t.datetime "deleted_at" end - add_index "namespaces", ["created_at", "id"], name: "index_namespaces_on_created_at_and_id", using: :btree + add_index "namespaces", ["created_at"], name: "index_namespaces_on_created_at", using: :btree + add_index "namespaces", ["deleted_at"], name: "index_namespaces_on_deleted_at", using: :btree add_index "namespaces", ["name"], name: "index_namespaces_on_name", unique: true, using: :btree add_index "namespaces", ["name"], name: "index_namespaces_on_name_trigram", using: :gin, opclasses: {"name"=>"gin_trgm_ops"} add_index "namespaces", ["owner_id"], name: "index_namespaces_on_owner_id", using: :btree add_index "namespaces", ["path"], name: "index_namespaces_on_path", unique: true, using: :btree add_index "namespaces", ["path"], name: "index_namespaces_on_path_trigram", using: :gin, opclasses: {"path"=>"gin_trgm_ops"} add_index "namespaces", ["type"], name: "index_namespaces_on_type", using: :btree - add_index "namespaces", ["visibility_level"], name: "index_namespaces_on_visibility_level", using: :btree create_table "notes", force: :cascade do |t| t.text "note" @@ -711,7 +673,6 @@ ActiveRecord::Schema.define(version: 20160804150737) do 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 - add_index "notes", ["created_at", "id"], name: "index_notes_on_created_at_and_id", using: :btree add_index "notes", ["created_at"], name: "index_notes_on_created_at", using: :btree add_index "notes", ["line_code"], name: "index_notes_on_line_code", using: :btree add_index "notes", ["note"], name: "index_notes_on_note_trigram", using: :gin, opclasses: {"note"=>"gin_trgm_ops"} @@ -851,9 +812,8 @@ ActiveRecord::Schema.define(version: 20160804150737) do t.boolean "request_access_enabled", default: true, null: false end - add_index "projects", ["builds_enabled", "shared_runners_enabled"], name: "index_projects_on_builds_enabled_and_shared_runners_enabled", using: :btree add_index "projects", ["ci_id"], name: "index_projects_on_ci_id", using: :btree - add_index "projects", ["created_at", "id"], name: "index_projects_on_created_at_and_id", using: :btree + add_index "projects", ["created_at"], name: "index_projects_on_created_at", using: :btree add_index "projects", ["creator_id"], name: "index_projects_on_creator_id", using: :btree add_index "projects", ["description"], name: "index_projects_on_description_trigram", using: :gin, opclasses: {"description"=>"gin_trgm_ops"} add_index "projects", ["last_activity_at"], name: "index_projects_on_last_activity_at", using: :btree @@ -937,11 +897,9 @@ ActiveRecord::Schema.define(version: 20160804150737) do t.string "category", default: "common", null: false t.boolean "default", default: false t.boolean "wiki_page_events", default: true + t.boolean "pipeline_events", default: false, null: false end - add_index "services", ["category"], name: "index_services_on_category", using: :btree - add_index "services", ["created_at", "id"], name: "index_services_on_created_at_and_id", using: :btree - add_index "services", ["default"], name: "index_services_on_default", using: :btree add_index "services", ["project_id"], name: "index_services_on_project_id", using: :btree add_index "services", ["template"], name: "index_services_on_template", using: :btree @@ -958,8 +916,6 @@ ActiveRecord::Schema.define(version: 20160804150737) do end add_index "snippets", ["author_id"], name: "index_snippets_on_author_id", using: :btree - add_index "snippets", ["created_at", "id"], name: "index_snippets_on_created_at_and_id", using: :btree - add_index "snippets", ["created_at"], name: "index_snippets_on_created_at", using: :btree add_index "snippets", ["file_name"], name: "index_snippets_on_file_name_trigram", using: :gin, opclasses: {"file_name"=>"gin_trgm_ops"} add_index "snippets", ["project_id"], name: "index_snippets_on_project_id", using: :btree add_index "snippets", ["title"], name: "index_snippets_on_title_trigram", using: :gin, opclasses: {"title"=>"gin_trgm_ops"} @@ -971,12 +927,12 @@ ActiveRecord::Schema.define(version: 20160804150737) do t.string "source_ip" t.string "user_agent" t.boolean "via_api" - t.integer "project_id" t.string "noteable_type" t.string "title" t.text "description" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.boolean "submitted_as_ham", default: false, null: false end create_table "subscriptions", force: :cascade do |t| @@ -1028,7 +984,6 @@ ActiveRecord::Schema.define(version: 20160804150737) do add_index "todos", ["commit_id"], name: "index_todos_on_commit_id", using: :btree add_index "todos", ["note_id"], name: "index_todos_on_note_id", using: :btree add_index "todos", ["project_id"], name: "index_todos_on_project_id", using: :btree - add_index "todos", ["state"], name: "index_todos_on_state", using: :btree add_index "todos", ["target_type", "target_id"], name: "index_todos_on_target_type_and_target_id", using: :btree add_index "todos", ["user_id"], name: "index_todos_on_user_id", using: :btree @@ -1045,6 +1000,16 @@ ActiveRecord::Schema.define(version: 20160804150737) do add_index "u2f_registrations", ["key_handle"], name: "index_u2f_registrations_on_key_handle", using: :btree add_index "u2f_registrations", ["user_id"], name: "index_u2f_registrations_on_user_id", using: :btree + create_table "user_agent_details", force: :cascade do |t| + t.string "user_agent", null: false + t.string "ip_address", null: false + t.integer "subject_id", null: false + t.string "subject_type", null: false + t.boolean "submitted", default: false, null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + create_table "users", force: :cascade do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false @@ -1108,7 +1073,7 @@ ActiveRecord::Schema.define(version: 20160804150737) do add_index "users", ["admin"], name: "index_users_on_admin", using: :btree add_index "users", ["authentication_token"], name: "index_users_on_authentication_token", unique: true, using: :btree add_index "users", ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true, using: :btree - add_index "users", ["created_at", "id"], name: "index_users_on_created_at_and_id", using: :btree + add_index "users", ["created_at"], name: "index_users_on_created_at", using: :btree add_index "users", ["current_sign_in_at"], name: "index_users_on_current_sign_in_at", using: :btree add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree add_index "users", ["email"], name: "index_users_on_email_trigram", using: :gin, opclasses: {"email"=>"gin_trgm_ops"} @@ -1146,9 +1111,9 @@ ActiveRecord::Schema.define(version: 20160804150737) do t.boolean "build_events", default: false, null: false t.boolean "wiki_page_events", default: false, null: false t.string "token" + t.boolean "pipeline_events", default: false, null: false end - add_index "web_hooks", ["created_at", "id"], name: "index_web_hooks_on_created_at_and_id", using: :btree add_index "web_hooks", ["project_id"], name: "index_web_hooks_on_project_id", using: :btree add_foreign_key "personal_access_tokens", "users" |