From 8458aecc76af18de675ccd39df86099f87405865 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Thu, 21 Aug 2014 00:49:26 +0400 Subject: [PATCH] Fixed: rake db:migrate from zero --- .../20111012223006_create_permissions.rb | 4 +- db/migrate/20111012223306_create_roles.rb | 1 - db/migrate/20111012223521_create_relations.rb | 4 +- ...020160644_add_new_fields_to_build_lists.rb | 4 +- ...20111023154034_add_global_role_to_users.rb | 2 +- ...0111023154130_add_global_role_to_groups.rb | 2 +- .../20120111080234_change_commentable_id.rb | 2 +- ...23161250_change_subscribeable_to_string.rb | 2 +- .../20120219161749_add_creator_to_issue.rb | 2 +- .../20120428053303_create_advisories.rb | 4 +- ...1_add_save_to_repository_to_build_lists.rb | 2 +- ...119_set_string_type_for_key_pairs_keyid.rb | 2 +- ...822130632_add_maintainer_id_to_projects.rb | 2 +- ...22905_add_encrypted_secret_to_key_pairs.rb | 6 +- ...0130214101404_create_project_tags_table.rb | 2 +- ...20130326165628_add_add_info_to_comments.rb | 2 +- ...112110_add_published_user_to_build_list.rb | 2 +- ...tra_repos_and_build_lists_to_mass_build.rb | 4 +- ...31017171426_add_builder_into_build_list.rb | 2 +- db/schema.rb | 512 +++++++++++------- 20 files changed, 335 insertions(+), 228 deletions(-) diff --git a/db/migrate/20111012223006_create_permissions.rb b/db/migrate/20111012223006_create_permissions.rb index 7d68b13fa..fb897bc90 100644 --- a/db/migrate/20111012223006_create_permissions.rb +++ b/db/migrate/20111012223006_create_permissions.rb @@ -1,8 +1,8 @@ class CreatePermissions < ActiveRecord::Migration def change create_table :permissions do |t| - t.integer :right_id - t.integer :role_id + t.integer :right_id, references: nil + t.integer :role_id, references: nil t.timestamps end diff --git a/db/migrate/20111012223306_create_roles.rb b/db/migrate/20111012223306_create_roles.rb index 3eca524eb..c31c4615a 100644 --- a/db/migrate/20111012223306_create_roles.rb +++ b/db/migrate/20111012223306_create_roles.rb @@ -1,7 +1,6 @@ class CreateRoles < ActiveRecord::Migration def change create_table :roles do |t| - t.integer :id t.string :name t.timestamps diff --git a/db/migrate/20111012223521_create_relations.rb b/db/migrate/20111012223521_create_relations.rb index 8017f07f4..6a9f124ee 100644 --- a/db/migrate/20111012223521_create_relations.rb +++ b/db/migrate/20111012223521_create_relations.rb @@ -1,9 +1,9 @@ class CreateRelations < ActiveRecord::Migration def self.up create_table :relations do |t| - t.integer :object_id + t.integer :object_id, references: nil t.string :object_type - t.integer :target_id + t.integer :target_id, references: nil t.string :target_type t.timestamps diff --git a/db/migrate/20111020160644_add_new_fields_to_build_lists.rb b/db/migrate/20111020160644_add_new_fields_to_build_lists.rb index 35cc1772e..da0709826 100644 --- a/db/migrate/20111020160644_add_new_fields_to_build_lists.rb +++ b/db/migrate/20111020160644_add_new_fields_to_build_lists.rb @@ -2,8 +2,8 @@ class AddNewFieldsToBuildLists < ActiveRecord::Migration def self.up add_column :build_lists, :build_requires, :boolean add_column :build_lists, :update_type, :string - add_column :build_lists, :bpl_id, :integer - add_column :build_lists, :pl_id, :integer + add_column :build_lists, :bpl_id, :integer, references: nil + add_column :build_lists, :pl_id, :integer, references: nil rename_column :build_lists, :branch_name, :project_version end diff --git a/db/migrate/20111023154034_add_global_role_to_users.rb b/db/migrate/20111023154034_add_global_role_to_users.rb index 94ea1f1c4..54316bed6 100644 --- a/db/migrate/20111023154034_add_global_role_to_users.rb +++ b/db/migrate/20111023154034_add_global_role_to_users.rb @@ -1,6 +1,6 @@ class AddGlobalRoleToUsers < ActiveRecord::Migration def self.up - add_column :users, :global_role_id, :integer + add_column :users, :global_role_id, :integer, references: nil end def self.down diff --git a/db/migrate/20111023154130_add_global_role_to_groups.rb b/db/migrate/20111023154130_add_global_role_to_groups.rb index b1d5f38a2..f31257d52 100644 --- a/db/migrate/20111023154130_add_global_role_to_groups.rb +++ b/db/migrate/20111023154130_add_global_role_to_groups.rb @@ -1,6 +1,6 @@ class AddGlobalRoleToGroups < ActiveRecord::Migration def self.up - add_column :groups, :global_role_id, :integer + add_column :groups, :global_role_id, :integer, references: nil end def self.down diff --git a/db/migrate/20120111080234_change_commentable_id.rb b/db/migrate/20120111080234_change_commentable_id.rb index 60c3c3268..fbe62f69e 100644 --- a/db/migrate/20120111080234_change_commentable_id.rb +++ b/db/migrate/20120111080234_change_commentable_id.rb @@ -1,6 +1,6 @@ class ChangeCommentableId < ActiveRecord::Migration def self.up - change_column :comments, :commentable_id, :string + change_column :comments, :commentable_id, :string, references: nil end def self.down diff --git a/db/migrate/20120123161250_change_subscribeable_to_string.rb b/db/migrate/20120123161250_change_subscribeable_to_string.rb index fcee398de..a7bbe5083 100644 --- a/db/migrate/20120123161250_change_subscribeable_to_string.rb +++ b/db/migrate/20120123161250_change_subscribeable_to_string.rb @@ -1,6 +1,6 @@ class ChangeSubscribeableToString < ActiveRecord::Migration def self.up - change_column :subscribes, :subscribeable_id, :string + change_column :subscribes, :subscribeable_id, :string, references: nil end def self.down diff --git a/db/migrate/20120219161749_add_creator_to_issue.rb b/db/migrate/20120219161749_add_creator_to_issue.rb index 54a3ba492..1829bc16c 100644 --- a/db/migrate/20120219161749_add_creator_to_issue.rb +++ b/db/migrate/20120219161749_add_creator_to_issue.rb @@ -1,5 +1,5 @@ class AddCreatorToIssue < ActiveRecord::Migration def change - add_column :issues, :creator_id, :integer + add_column :issues, :creator_id, :integer, references: nil end end diff --git a/db/migrate/20120428053303_create_advisories.rb b/db/migrate/20120428053303_create_advisories.rb index 8886e2aea..dc18875ec 100644 --- a/db/migrate/20120428053303_create_advisories.rb +++ b/db/migrate/20120428053303_create_advisories.rb @@ -1,8 +1,8 @@ class CreateAdvisories < ActiveRecord::Migration def change create_table :advisories do |t| - t.string :advisory_id - t.integer :project_id + t.string :advisory_id, references: nil + t.integer :project_id, references: nil t.text :description, default: '' t.text :references, default: '' t.text :update_type, default: '' diff --git a/db/migrate/20120727141521_add_save_to_repository_to_build_lists.rb b/db/migrate/20120727141521_add_save_to_repository_to_build_lists.rb index 99768ba40..9d35d40df 100644 --- a/db/migrate/20120727141521_add_save_to_repository_to_build_lists.rb +++ b/db/migrate/20120727141521_add_save_to_repository_to_build_lists.rb @@ -1,6 +1,6 @@ class AddSaveToRepositoryToBuildLists < ActiveRecord::Migration def self.up - add_column :build_lists, :save_to_repository_id, :integer + add_column :build_lists, :save_to_repository_id, :integer, references: nil BuildList.includes(project: :repositories, save_to_platform: :repositories).find_in_batches do |batch| batch.each do |bl| diff --git a/db/migrate/20120730185119_set_string_type_for_key_pairs_keyid.rb b/db/migrate/20120730185119_set_string_type_for_key_pairs_keyid.rb index da6337e16..59b107693 100644 --- a/db/migrate/20120730185119_set_string_type_for_key_pairs_keyid.rb +++ b/db/migrate/20120730185119_set_string_type_for_key_pairs_keyid.rb @@ -1,6 +1,6 @@ class SetStringTypeForKeyPairsKeyid < ActiveRecord::Migration def up - change_column :key_pairs, :key_id, :string + change_column :key_pairs, :key_id, :string, references: nil end def down diff --git a/db/migrate/20120822130632_add_maintainer_id_to_projects.rb b/db/migrate/20120822130632_add_maintainer_id_to_projects.rb index 94614ef56..267ae2bf8 100644 --- a/db/migrate/20120822130632_add_maintainer_id_to_projects.rb +++ b/db/migrate/20120822130632_add_maintainer_id_to_projects.rb @@ -1,6 +1,6 @@ class AddMaintainerIdToProjects < ActiveRecord::Migration def self.up - add_column :projects, :maintainer_id, :integer + add_column :projects, :maintainer_id, :integer, references: nil end def self.down diff --git a/db/migrate/20121219122905_add_encrypted_secret_to_key_pairs.rb b/db/migrate/20121219122905_add_encrypted_secret_to_key_pairs.rb index 514a8f6ea..08ed74fda 100644 --- a/db/migrate/20121219122905_add_encrypted_secret_to_key_pairs.rb +++ b/db/migrate/20121219122905_add_encrypted_secret_to_key_pairs.rb @@ -1,12 +1,12 @@ class AddEncryptedSecretToKeyPairs < ActiveRecord::Migration def up rename_table :key_pairs, :key_pairs_backup - rename_index :key_pairs_backup, 'index_key_pairs_on_repository_id', 'index_key_pairs_backup_on_repository_id' + # rename_index :key_pairs_backup, 'index_key_pairs_on_repository_id', 'index_key_pairs_backup_on_repository_id' create_table :key_pairs do |t| t.text :public, null: false t.text :encrypted_secret, null: false - t.string :key_id, null: false + t.string :key_id, null: false, references: nil t.references :user, null: false t.references :repository, null: false t.timestamps @@ -17,6 +17,6 @@ class AddEncryptedSecretToKeyPairs < ActiveRecord::Migration def down drop_table :key_pairs rename_table :key_pairs_backup, :key_pairs - rename_index :key_pairs, 'index_key_pairs_backup_on_repository_id', 'index_key_pairs_on_repository_id' + # rename_index :key_pairs, 'index_key_pairs_backup_on_repository_id', 'index_key_pairs_on_repository_id' end end diff --git a/db/migrate/20130214101404_create_project_tags_table.rb b/db/migrate/20130214101404_create_project_tags_table.rb index d78365bd2..7ad38174a 100644 --- a/db/migrate/20130214101404_create_project_tags_table.rb +++ b/db/migrate/20130214101404_create_project_tags_table.rb @@ -2,7 +2,7 @@ class CreateProjectTagsTable < ActiveRecord::Migration def change create_table :project_tags do |t| t.integer :project_id - t.string :commit_id + t.string :commit_id, references: nil t.string :sha1 t.string :tag_name t.integer :format_id, references: nil diff --git a/db/migrate/20130326165628_add_add_info_to_comments.rb b/db/migrate/20130326165628_add_add_info_to_comments.rb index ca1a34041..a4e6289f8 100644 --- a/db/migrate/20130326165628_add_add_info_to_comments.rb +++ b/db/migrate/20130326165628_add_add_info_to_comments.rb @@ -1,7 +1,7 @@ class AddAddInfoToComments < ActiveRecord::Migration def change add_column :comments, :created_from_commit_hash, :decimal, precision: 50, scale: 0 - add_column :comments, :created_from_issue_id, :integer + add_column :comments, :created_from_issue_id, :integer, references: nil add_index :comments, :created_from_issue_id add_index :comments, :created_from_commit_hash diff --git a/db/migrate/20130328112110_add_published_user_to_build_list.rb b/db/migrate/20130328112110_add_published_user_to_build_list.rb index b7d31b4e5..ff22d4392 100644 --- a/db/migrate/20130328112110_add_published_user_to_build_list.rb +++ b/db/migrate/20130328112110_add_published_user_to_build_list.rb @@ -1,5 +1,5 @@ class AddPublishedUserToBuildList < ActiveRecord::Migration def change - add_column :build_lists, :publisher_id, :integer + add_column :build_lists, :publisher_id, :integer, references: nil end end diff --git a/db/migrate/20130603124853_add_extra_repos_and_build_lists_to_mass_build.rb b/db/migrate/20130603124853_add_extra_repos_and_build_lists_to_mass_build.rb index 7cddde1cc..7b244c1ec 100644 --- a/db/migrate/20130603124853_add_extra_repos_and_build_lists_to_mass_build.rb +++ b/db/migrate/20130603124853_add_extra_repos_and_build_lists_to_mass_build.rb @@ -3,9 +3,9 @@ class AddExtraReposAndBuildListsToMassBuild < ActiveRecord::Migration end def up - add_column :mass_builds, :save_to_platform_id, :integer + add_column :mass_builds, :save_to_platform_id, :integer, references: nil MassBuild.update_all('save_to_platform_id = platform_id') - change_column :mass_builds, :save_to_platform_id, :integer, null: false + change_column :mass_builds, :save_to_platform_id, :integer, null: false, references: nil change_column :mass_builds, :platform_id, :integer, null: false rename_column :mass_builds, :platform_id, :build_for_platform_id add_column :mass_builds, :extra_repositories, :text diff --git a/db/migrate/20131017171426_add_builder_into_build_list.rb b/db/migrate/20131017171426_add_builder_into_build_list.rb index 4d989bcf5..432f0b1f8 100644 --- a/db/migrate/20131017171426_add_builder_into_build_list.rb +++ b/db/migrate/20131017171426_add_builder_into_build_list.rb @@ -1,5 +1,5 @@ class AddBuilderIntoBuildList < ActiveRecord::Migration def change - add_column :build_lists, :builder_id, :integer + add_column :build_lists, :builder_id, :integer, references: nil end end diff --git a/db/schema.rb b/db/schema.rb index 418f449e5..17d3bebb4 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -17,6 +17,46 @@ ActiveRecord::Schema.define(version: 20140709194335) do enable_extension "plpgsql" enable_extension "hstore" + create_table "users", force: true do |t| + t.string "name" + t.string "email", default: "", null: false + t.string "encrypted_password", default: "", null: false + t.string "reset_password_token" + t.datetime "reset_password_sent_at" + t.datetime "remember_created_at" + t.datetime "created_at" + t.datetime "updated_at" + t.text "ssh_key" + t.string "uname" + t.string "role" + t.string "language", default: "en" + t.integer "own_projects_count", default: 0, null: false + t.string "confirmation_token" + t.datetime "confirmed_at" + t.datetime "confirmation_sent_at" + t.text "professional_experience" + t.string "site" + t.string "company" + t.string "location" + t.string "avatar_file_name" + t.string "avatar_content_type" + t.integer "avatar_file_size" + t.datetime "avatar_updated_at" + t.integer "failed_attempts", default: 0 + t.string "unlock_token" + t.datetime "locked_at" + t.string "authentication_token" + t.integer "build_priority", default: 50 + t.boolean "sound_notifications", default: true + t.boolean "hide_email", default: true, null: false + t.index ["authentication_token"], :name => "index_users_on_authentication_token" + t.index ["confirmation_token"], :name => "index_users_on_confirmation_token", :unique => true + t.index ["email"], :name => "index_users_on_email", :unique => true + t.index ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true + t.index ["uname"], :name => "index_users_on_uname", :unique => true + t.index ["unlock_token"], :name => "index_users_on_unlock_token", :unique => true + end + create_table "activity_feeds", force: true do |t| t.integer "user_id", null: false t.string "kind" @@ -24,6 +64,8 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.datetime "created_at" t.datetime "updated_at" t.index ["user_id", "kind"], :name => "index_activity_feeds_on_user_id_and_kind" + t.index ["user_id"], :name => "fk__activity_feeds_user_id" + t.foreign_key ["user_id"], "users", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_activity_feeds_user_id" end create_table "advisories", force: true do |t| @@ -31,26 +73,79 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.text "description", default: "" t.text "references", default: "" t.text "update_type", default: "" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.index ["advisory_id"], :name => "index_advisories_on_advisory_id", :unique => true t.index ["update_type"], :name => "index_advisories_on_update_type" end + create_table "platforms", force: true do |t| + t.string "description" + t.string "name", null: false + t.integer "parent_platform_id" + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "released", default: false, null: false + t.integer "owner_id" + t.string "owner_type" + t.string "visibility", default: "open", null: false + t.string "platform_type", default: "main", null: false + t.string "distrib_type" + t.integer "status" + t.datetime "last_regenerated_at" + t.integer "last_regenerated_status" + t.string "last_regenerated_log_sha1" + t.string "automatic_metadata_regeneration" + t.index ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false + end + create_table "advisories_platforms", id: false, force: true do |t| t.integer "advisory_id" t.integer "platform_id" t.index ["advisory_id", "platform_id"], :name => "advisory_platform_index", :unique => true + t.index ["advisory_id"], :name => "fk__advisories_platforms_advisory_id" t.index ["advisory_id"], :name => "index_advisories_platforms_on_advisory_id" + t.index ["platform_id"], :name => "fk__advisories_platforms_platform_id" t.index ["platform_id"], :name => "index_advisories_platforms_on_platform_id" + t.foreign_key ["advisory_id"], "advisories", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_advisories_platforms_advisory_id" + t.foreign_key ["platform_id"], "platforms", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_advisories_platforms_platform_id" + end + + create_table "projects", force: true do |t| + t.string "name" + t.datetime "created_at" + t.datetime "updated_at" + t.integer "owner_id" + t.string "owner_type" + t.string "visibility", default: "open" + t.text "description" + t.string "ancestry" + t.boolean "has_issues", default: true + t.boolean "has_wiki", default: false + t.string "srpm_file_name" + t.string "srpm_content_type" + t.integer "srpm_file_size" + t.datetime "srpm_updated_at" + t.string "default_branch", default: "master" + t.boolean "is_package", default: true, null: false + t.integer "maintainer_id" + t.boolean "publish_i686_into_x86_64", default: false + t.string "owner_uname", null: false + t.boolean "architecture_dependent", default: false, null: false + t.integer "autostart_status" + t.index ["name", "owner_id", "owner_type"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true, :case_sensitive => false end create_table "advisories_projects", id: false, force: true do |t| t.integer "advisory_id" t.integer "project_id" t.index ["advisory_id", "project_id"], :name => "advisory_project_index", :unique => true + t.index ["advisory_id"], :name => "fk__advisories_projects_advisory_id" t.index ["advisory_id"], :name => "index_advisories_projects_on_advisory_id" + t.index ["project_id"], :name => "fk__advisories_projects_project_id" t.index ["project_id"], :name => "index_advisories_projects_on_project_id" + t.foreign_key ["advisory_id"], "advisories", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_advisories_projects_advisory_id" + t.foreign_key ["project_id"], "projects", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_advisories_projects_project_id" end create_table "arches", force: true do |t| @@ -67,40 +162,53 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.datetime "created_at" t.datetime "updated_at" t.index ["provider", "uid"], :name => "index_authentications_on_provider_and_uid", :unique => true + t.index ["user_id"], :name => "fk__authentications_user_id" t.index ["user_id"], :name => "index_authentications_on_user_id" + t.foreign_key ["user_id"], "users", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_authentications_user_id" end - create_table "build_list_items", force: true do |t| - t.string "name" - t.integer "level" - t.integer "status" - t.integer "build_list_id" + create_table "groups", force: true do |t| + t.integer "owner_id" t.datetime "created_at" t.datetime "updated_at" - t.string "version" - t.index ["build_list_id"], :name => "index_build_list_items_on_build_list_id" + t.string "uname" + t.integer "own_projects_count", default: 0, null: false + t.text "description" + t.string "avatar_file_name" + t.string "avatar_content_type" + t.integer "avatar_file_size" + t.datetime "avatar_updated_at" end - create_table "build_list_packages", force: true do |t| - t.integer "build_list_id" - t.integer "project_id" - t.integer "platform_id" - t.string "fullname" + create_table "mass_builds", force: true do |t| + t.integer "build_for_platform_id", null: false t.string "name" - t.string "version" - t.string "release" - t.string "package_type" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.boolean "actual", default: false - t.string "sha1" - t.integer "epoch" - t.text "dependent_packages" - t.index ["actual", "platform_id"], :name => "index_build_list_packages_on_actual_and_platform_id" - t.index ["build_list_id"], :name => "index_build_list_packages_on_build_list_id" - t.index ["name", "project_id"], :name => "index_build_list_packages_on_name_and_project_id" - t.index ["platform_id"], :name => "index_build_list_packages_on_platform_id" - t.index ["project_id"], :name => "index_build_list_packages_on_project_id" + t.datetime "created_at" + t.datetime "updated_at" + t.string "arch_names" + t.integer "user_id" + t.integer "build_lists_count", default: 0, null: false + t.boolean "stop_build", default: false, null: false + t.text "projects_list" + t.integer "missed_projects_count", default: 0, null: false + t.text "missed_projects_list" + t.boolean "new_core", default: true + t.integer "save_to_platform_id", null: false + t.text "extra_repositories" + t.text "extra_build_lists" + t.boolean "increase_release_tag", default: false, null: false + t.boolean "use_cached_chroot", default: true, null: false + t.boolean "use_extra_tests", default: false, null: false + t.string "description" + t.string "auto_publish_status", default: "none", null: false + t.text "extra_mass_builds" + t.boolean "include_testing_subrepository", default: false, null: false + t.boolean "auto_create_container", default: false, null: false + t.integer "status", default: 2000, null: false + t.index ["build_for_platform_id"], :name => "fk__mass_builds_platform_id" + t.index ["user_id"], :name => "fk__mass_builds_user_id" + t.foreign_key ["build_for_platform_id"], "platforms", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_mass_builds_platform_id" + t.foreign_key ["user_id"], "users", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_mass_builds_user_id" end create_table "build_lists", force: true do |t| @@ -143,36 +251,64 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.string "auto_publish_status", default: "default", null: false t.boolean "use_cached_chroot", default: false, null: false t.boolean "use_extra_tests", default: true, null: false + t.index ["advisory_id"], :name => "fk__build_lists_advisory_id" t.index ["advisory_id"], :name => "index_build_lists_on_advisory_id" + t.index ["arch_id"], :name => "fk__build_lists_arch_id" t.index ["arch_id"], :name => "index_build_lists_on_arch_id" + t.index ["group_id"], :name => "fk__build_lists_group_id" t.index ["mass_build_id", "status"], :name => "index_build_lists_on_mass_build_id_and_status" + t.index ["mass_build_id"], :name => "fk__build_lists_mass_build_id" t.index ["project_id", "save_to_repository_id", "build_for_platform_id", "arch_id"], :name => "maintainer_search_index" + t.index ["project_id"], :name => "fk__build_lists_project_id" t.index ["project_id"], :name => "index_build_lists_on_project_id" + t.index ["user_id"], :name => "fk__build_lists_user_id" + t.foreign_key ["advisory_id"], "advisories", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_build_lists_advisory_id" + t.foreign_key ["arch_id"], "arches", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_build_lists_arch_id" + t.foreign_key ["group_id"], "groups", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_build_lists_group_id" + t.foreign_key ["mass_build_id"], "mass_builds", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_build_lists_mass_build_id" + t.foreign_key ["project_id"], "projects", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_build_lists_project_id" + t.foreign_key ["user_id"], "users", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_build_lists_user_id" end - create_table "projects", force: true do |t| + create_table "build_list_items", force: true do |t| t.string "name" + t.integer "level" + t.integer "status" + t.integer "build_list_id" t.datetime "created_at" t.datetime "updated_at" - t.integer "owner_id" - t.string "owner_type" - t.string "visibility", default: "open" - t.text "description" - t.string "ancestry" - t.boolean "has_issues", default: true - t.string "srpm_file_name" - t.integer "srpm_file_size" - t.datetime "srpm_updated_at" - t.string "srpm_content_type" - t.boolean "has_wiki", default: false - t.string "default_branch", default: "master" - t.boolean "is_package", default: true, null: false - t.integer "maintainer_id" - t.boolean "publish_i686_into_x86_64", default: false - t.string "owner_uname", null: false - t.boolean "architecture_dependent", default: false, null: false - t.integer "autostart_status" - t.index ["name", "owner_id", "owner_type"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true, :case_sensitive => false + t.string "version" + t.index ["build_list_id"], :name => "fk__build_list_items_build_list_id" + t.index ["build_list_id"], :name => "index_build_list_items_on_build_list_id" + t.foreign_key ["build_list_id"], "build_lists", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_build_list_items_build_list_id" + end + + create_table "build_list_packages", force: true do |t| + t.integer "build_list_id" + t.integer "project_id" + t.integer "platform_id" + t.string "fullname" + t.string "name" + t.string "version" + t.string "release" + t.string "package_type" + t.datetime "created_at" + t.datetime "updated_at" + t.boolean "actual", default: false + t.string "sha1" + t.integer "epoch" + t.text "dependent_packages" + t.index ["actual", "platform_id"], :name => "index_build_list_packages_on_actual_and_platform_id" + t.index ["build_list_id"], :name => "fk__build_list_packages_build_list_id" + t.index ["build_list_id"], :name => "index_build_list_packages_on_build_list_id" + t.index ["name", "project_id"], :name => "index_build_list_packages_on_name_and_project_id" + t.index ["platform_id"], :name => "fk__build_list_packages_platform_id" + t.index ["platform_id"], :name => "index_build_list_packages_on_platform_id" + t.index ["project_id"], :name => "fk__build_list_packages_project_id" + t.index ["project_id"], :name => "index_build_list_packages_on_project_id" + t.foreign_key ["build_list_id"], "build_lists", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_build_list_packages_build_list_id" + t.foreign_key ["platform_id"], "platforms", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_build_list_packages_platform_id" + t.foreign_key ["project_id"], "projects", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_build_list_packages_project_id" end create_table "build_scripts", force: true do |t| @@ -205,6 +341,10 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.index ["commentable_type"], :name => "index_comments_on_commentable_type" t.index ["created_from_commit_hash"], :name => "index_comments_on_created_from_commit_hash" t.index ["created_from_issue_id"], :name => "index_comments_on_created_from_issue_id" + t.index ["project_id"], :name => "fk__comments_project_id" + t.index ["user_id"], :name => "fk__comments_user_id" + t.foreign_key ["project_id"], "projects", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_comments_project_id" + t.foreign_key ["user_id"], "users", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_comments_user_id" end create_table "event_logs", force: true do |t| @@ -221,6 +361,8 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.text "message" t.datetime "created_at" t.datetime "updated_at" + t.index ["user_id"], :name => "fk__event_logs_user_id" + t.foreign_key ["user_id"], "users", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_event_logs_user_id" end create_table "flash_notifies", force: true do |t| @@ -228,29 +370,18 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.text "body_en", null: false t.string "status", null: false t.boolean "published", default: true, null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - end - - create_table "groups", force: true do |t| - t.integer "owner_id" t.datetime "created_at" t.datetime "updated_at" - t.string "uname" - t.integer "own_projects_count", default: 0, null: false - t.text "description" - t.string "avatar_file_name" - t.string "avatar_content_type" - t.integer "avatar_file_size" - t.datetime "avatar_updated_at" end create_table "hooks", force: true do |t| t.text "data" t.integer "project_id" t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" + t.index ["project_id"], :name => "fk__hooks_project_id" + t.foreign_key ["project_id"], "projects", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_hooks_project_id" end create_table "issues", force: true do |t| @@ -265,8 +396,26 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.integer "user_id" t.datetime "closed_at" t.integer "closed_by" + t.index ["assignee_id"], :name => "fk__issues_user_id" t.index ["project_id", "serial_id"], :name => "index_issues_on_project_id_and_serial_id", :unique => true + t.index ["project_id"], :name => "fk__issues_project_id" t.index ["user_id"], :name => "index_issues_on_user_id" + t.foreign_key ["assignee_id"], "users", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_issues_user_id" + t.foreign_key ["project_id"], "projects", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_issues_project_id" + end + + create_table "repositories", force: true do |t| + t.string "description", null: false + t.integer "platform_id", null: false + t.datetime "created_at" + t.datetime "updated_at" + t.string "name", null: false + t.boolean "publish_without_qa", default: true + t.boolean "synchronizing_publications", default: false, null: false + t.string "publish_builds_only_from_branch" + t.index ["platform_id"], :name => "fk__repositories_platform_id" + t.index ["platform_id"], :name => "index_repositories_on_platform_id" + t.foreign_key ["platform_id"], "platforms", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_repositories_platform_id" end create_table "key_pairs", force: true do |t| @@ -275,9 +424,13 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.string "key_id", null: false t.integer "user_id", null: false t.integer "repository_id", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" + t.index ["repository_id"], :name => "fk__key_pairs_repository_id" t.index ["repository_id"], :name => "index_key_pairs_on_repository_id", :unique => true + t.index ["user_id"], :name => "fk__key_pairs_user_id" + t.foreign_key ["repository_id"], "repositories", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_key_pairs_repository_id" + t.foreign_key ["user_id"], "users", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_key_pairs_user_id" end create_table "key_pairs_backup", force: true do |t| @@ -285,93 +438,36 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.integer "user_id", null: false t.string "key_id", null: false t.text "public", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" + t.index ["repository_id"], :name => "fk__key_pairs_backup_repository_id" t.index ["repository_id"], :name => "index_key_pairs_backup_on_repository_id", :unique => true - end - - create_table "labelings", force: true do |t| - t.integer "label_id", null: false - t.integer "issue_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["issue_id"], :name => "index_labelings_on_issue_id" + t.index ["user_id"], :name => "fk__key_pairs_backup_user_id" + t.foreign_key ["repository_id"], "repositories", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_key_pairs_backup_repository_id" + t.foreign_key ["user_id"], "users", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_key_pairs_backup_user_id" end create_table "labels", force: true do |t| t.string "name", null: false t.string "color", null: false t.integer "project_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["project_id"], :name => "index_labels_on_project_id" - end - - create_table "mass_builds", force: true do |t| - t.integer "build_for_platform_id", null: false - t.string "name" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "arch_names" - t.integer "user_id" - t.integer "build_lists_count", default: 0, null: false - t.boolean "stop_build", default: false, null: false - t.text "projects_list" - t.integer "missed_projects_count", default: 0, null: false - t.text "missed_projects_list" - t.boolean "new_core", default: true - t.integer "save_to_platform_id", null: false - t.text "extra_repositories" - t.text "extra_build_lists" - t.boolean "increase_release_tag", default: false, null: false - t.boolean "use_cached_chroot", default: true, null: false - t.boolean "use_extra_tests", default: false, null: false - t.string "description" - t.string "auto_publish_status", default: "none", null: false - t.text "extra_mass_builds" - t.boolean "include_testing_subrepository", default: false, null: false - t.boolean "auto_create_container", default: false, null: false - t.integer "status", default: 2000, null: false - end - - create_table "users", force: true do |t| - t.string "name" - t.string "email", default: "", null: false - t.string "encrypted_password", limit: 128, default: "", null: false - t.string "reset_password_token" - t.datetime "reset_password_sent_at" - t.datetime "remember_created_at" t.datetime "created_at" t.datetime "updated_at" - t.text "ssh_key" - t.string "uname" - t.string "role" - t.string "language", default: "en" - t.integer "own_projects_count", default: 0, null: false - t.text "professional_experience" - t.string "site" - t.string "company" - t.string "location" - t.string "avatar_file_name" - t.string "avatar_content_type" - t.integer "avatar_file_size" - t.datetime "avatar_updated_at" - t.integer "failed_attempts", default: 0 - t.string "unlock_token" - t.datetime "locked_at" - t.string "confirmation_token" - t.datetime "confirmed_at" - t.datetime "confirmation_sent_at" - t.string "authentication_token" - t.integer "build_priority", default: 50 - t.boolean "sound_notifications", default: true - t.boolean "hide_email", default: true, null: false - t.index ["authentication_token"], :name => "index_users_on_authentication_token" - t.index ["confirmation_token"], :name => "index_users_on_confirmation_token", :unique => true - t.index ["email"], :name => "index_users_on_email", :unique => true - t.index ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true - t.index ["uname"], :name => "index_users_on_uname", :unique => true - t.index ["unlock_token"], :name => "index_users_on_unlock_token", :unique => true + t.index ["project_id"], :name => "fk__labels_project_id" + t.index ["project_id"], :name => "index_labels_on_project_id" + t.foreign_key ["project_id"], "projects", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_labels_project_id" + end + + create_table "labelings", force: true do |t| + t.integer "label_id", null: false + t.integer "issue_id" + t.datetime "created_at" + t.datetime "updated_at" + t.index ["issue_id"], :name => "fk__labelings_issue_id" + t.index ["issue_id"], :name => "index_labelings_on_issue_id" + t.index ["label_id"], :name => "fk__labelings_label_id" + t.foreign_key ["issue_id"], "issues", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_labelings_issue_id" + t.foreign_key ["label_id"], "labels", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_labelings_label_id" end create_table "node_instructions", force: true do |t| @@ -390,29 +486,31 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.integer "arch_id", null: false t.integer "time_living", null: false t.boolean "default" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.index ["platform_id", "arch_id"], :name => "index_platform_arch_settings_on_platform_id_and_arch_id", :unique => true - end - - create_table "platforms", force: true do |t| - t.string "description" - t.string "name", null: false - t.integer "parent_platform_id" t.datetime "created_at" t.datetime "updated_at" - t.boolean "released", default: false, null: false - t.integer "owner_id" - t.string "owner_type" - t.string "visibility", default: "open", null: false - t.string "platform_type", default: "main", null: false - t.string "distrib_type", null: false - t.integer "status" - t.datetime "last_regenerated_at" - t.integer "last_regenerated_status" - t.string "last_regenerated_log_sha1" - t.string "automatic_metadata_regeneration" - t.index ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false + t.index ["arch_id"], :name => "fk__platform_arch_settings_arch_id" + t.index ["platform_id", "arch_id"], :name => "index_platform_arch_settings_on_platform_id_and_arch_id", :unique => true + t.index ["platform_id"], :name => "fk__platform_arch_settings_platform_id" + t.foreign_key ["arch_id"], "arches", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_platform_arch_settings_arch_id" + t.foreign_key ["platform_id"], "platforms", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_platform_arch_settings_platform_id" + end + + create_table "products", force: true do |t| + t.string "name", null: false + t.integer "platform_id", null: false + t.datetime "created_at" + t.datetime "updated_at" + t.text "description" + t.integer "project_id" + t.string "params" + t.string "main_script" + t.integer "time_living" + t.integer "autostart_status" + t.string "project_version" + t.index ["platform_id"], :name => "fk__products_platform_id" + t.index ["project_id"], :name => "fk__products_project_id" + t.foreign_key ["platform_id"], "platforms", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_products_platform_id" + t.foreign_key ["project_id"], "projects", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_products_project_id" end create_table "product_build_lists", force: true do |t| @@ -431,21 +529,15 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.integer "user_id" t.boolean "not_delete", default: false t.boolean "autostarted", default: false + t.index ["arch_id"], :name => "fk__product_build_lists_arch_id" + t.index ["product_id"], :name => "fk__product_build_lists_product_id" t.index ["product_id"], :name => "index_product_build_lists_on_product_id" - end - - create_table "products", force: true do |t| - t.string "name", null: false - t.integer "platform_id", null: false - t.datetime "created_at" - t.datetime "updated_at" - t.text "description" - t.integer "project_id" - t.string "params" - t.string "main_script" - t.integer "time_living" - t.integer "autostart_status" - t.string "project_version" + t.index ["project_id"], :name => "fk__product_build_lists_project_id" + t.index ["user_id"], :name => "fk__product_build_lists_user_id" + t.foreign_key ["arch_id"], "arches", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_product_build_lists_arch_id" + t.foreign_key ["product_id"], "products", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_product_build_lists_product_id" + t.foreign_key ["project_id"], "projects", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_product_build_lists_project_id" + t.foreign_key ["user_id"], "users", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_product_build_lists_user_id" end create_table "project_imports", force: true do |t| @@ -457,6 +549,10 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.datetime "updated_at" t.integer "platform_id" t.index ["name", "platform_id"], :name => "index_project_imports_on_name_and_platform_id", :unique => true, :case_sensitive => false + t.index ["platform_id"], :name => "fk__project_imports_platform_id" + t.index ["project_id"], :name => "fk__project_imports_project_id" + t.foreign_key ["platform_id"], "platforms", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_project_imports_platform_id" + t.foreign_key ["project_id"], "projects", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_project_imports_project_id" end create_table "project_statistics", force: true do |t| @@ -464,9 +560,13 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.integer "build_count", default: 0, null: false t.integer "arch_id", null: false t.integer "project_id", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" + t.index ["arch_id"], :name => "fk__project_statistics_arch_id" t.index ["project_id", "arch_id"], :name => "index_project_statistics_on_project_id_and_arch_id", :unique => true + t.index ["project_id"], :name => "fk__project_statistics_project_id" + t.foreign_key ["arch_id"], "arches", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_project_statistics_arch_id" + t.foreign_key ["project_id"], "projects", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_project_statistics_project_id" end create_table "project_tags", force: true do |t| @@ -475,8 +575,10 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.string "sha1" t.string "tag_name" t.integer "format_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" + t.index ["project_id"], :name => "fk__project_tags_project_id" + t.foreign_key ["project_id"], "projects", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_project_tags_project_id" end create_table "project_to_repositories", force: true do |t| @@ -485,7 +587,11 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.datetime "created_at" t.datetime "updated_at" t.hstore "autostart_options" + t.index ["project_id"], :name => "fk__project_to_repositories_project_id" t.index ["repository_id", "project_id"], :name => "index_project_to_repositories_on_repository_id_and_project_id", :unique => true + t.index ["repository_id"], :name => "fk__project_to_repositories_repository_id" + t.foreign_key ["project_id"], "projects", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_project_to_repositories_project_id" + t.foreign_key ["repository_id"], "repositories", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_project_to_repositories_repository_id" end create_table "pull_requests", force: true do |t| @@ -496,9 +602,11 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.string "from_ref", null: false t.string "from_project_owner_uname" t.string "from_project_name" - t.index ["from_project_id"], :name => "index_pull_requests_on_head_project_id" + t.index ["from_project_id"], :name => "index_pull_requests_on_from_project_id" + t.index ["issue_id"], :name => "fk__pull_requests_issue_id" t.index ["issue_id"], :name => "index_pull_requests_on_issue_id" - t.index ["to_project_id"], :name => "index_pull_requests_on_base_project_id" + t.index ["to_project_id"], :name => "index_pull_requests_on_to_project_id" + t.foreign_key ["issue_id"], "issues", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_pull_requests_issue_id" end create_table "register_requests", force: true do |t| @@ -528,28 +636,20 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.index ["target_type", "target_id"], :name => "index_relations_on_target_type_and_target_id" end - create_table "repositories", force: true do |t| - t.string "description", null: false - t.integer "platform_id", null: false - t.datetime "created_at" - t.datetime "updated_at" - t.string "name", null: false - t.boolean "publish_without_qa", default: true - t.boolean "synchronizing_publications", default: false, null: false - t.string "publish_builds_only_from_branch" - t.index ["platform_id"], :name => "index_repositories_on_platform_id" - end - create_table "repository_statuses", force: true do |t| t.integer "repository_id", null: false t.integer "platform_id", null: false t.integer "status", default: 0 t.datetime "last_regenerated_at" t.integer "last_regenerated_status" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.string "last_regenerated_log_sha1" + t.index ["platform_id"], :name => "fk__repository_statuses_platform_id" t.index ["repository_id", "platform_id"], :name => "index_repository_statuses_on_repository_id_and_platform_id", :unique => true + t.index ["repository_id"], :name => "fk__repository_statuses_repository_id" + t.foreign_key ["platform_id"], "platforms", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_repository_statuses_platform_id" + t.foreign_key ["repository_id"], "repositories", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_repository_statuses_repository_id" end create_table "settings_notifiers", force: true do |t| @@ -567,6 +667,8 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.boolean "new_build", default: true t.boolean "new_associated_build", default: true t.boolean "update_code", default: false + t.index ["user_id"], :name => "fk__settings_notifiers_user_id" + t.foreign_key ["user_id"], "users", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_settings_notifiers_user_id" end create_table "ssh_keys", force: true do |t| @@ -574,10 +676,12 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.text "key", null: false t.string "fingerprint", null: false t.integer "user_id", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.index ["fingerprint"], :name => "index_ssh_keys_on_fingerprint", :unique => true + t.index ["user_id"], :name => "fk__ssh_keys_user_id" t.index ["user_id"], :name => "index_ssh_keys_on_user_id" + t.foreign_key ["user_id"], "users", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_ssh_keys_user_id" end create_table "subscribes", force: true do |t| @@ -588,6 +692,10 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.boolean "status", default: true t.integer "project_id" t.decimal "subscribeable_id", precision: 50, scale: 0 + t.index ["project_id"], :name => "fk__subscribes_project_id" + t.index ["user_id"], :name => "fk__subscribes_user_id" + t.foreign_key ["project_id"], "projects", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_subscribes_project_id" + t.foreign_key ["user_id"], "users", ["id"], :on_update => :no_action, :on_delete => :no_action, :name => "fk_subscribes_user_id" end create_table "tokens", force: true do |t| @@ -598,8 +706,8 @@ ActiveRecord::Schema.define(version: 20140709194335) do t.string "status", default: "active" t.text "description" t.string "authentication_token", null: false - t.datetime "created_at", null: false - t.datetime "updated_at", null: false + t.datetime "created_at" + t.datetime "updated_at" t.index ["authentication_token"], :name => "index_tokens_on_authentication_token", :unique => true t.index ["subject_id", "subject_type"], :name => "index_tokens_on_subject_id_and_subject_type" end