Commit 10aa84bd authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'squashed-migrations' into 'master'

Squashed migrations for 2011 and 2012
parents da34e008 e8f8abdd
class DeviseCreateUsers < ActiveRecord::Migration
def self.up
create_table(:users) do |t|
## Database authenticatable
t.string :email, :null => false, :default => ""
t.string :encrypted_password, :null => false, :default => ""
## Recoverable
t.string :reset_password_token
t.datetime :reset_password_sent_at
## Rememberable
t.datetime :remember_created_at
## Trackable
t.integer :sign_in_count, :default => 0
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.string :current_sign_in_ip
t.string :last_sign_in_ip
## Encryptable
# t.string :password_salt
## Confirmable
# t.string :confirmation_token
# t.datetime :confirmed_at
# t.datetime :confirmation_sent_at
# t.string :unconfirmed_email # Only if using reconfirmable
## Lockable
# t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts
# t.string :unlock_token # Only if unlock strategy is :email or :both
# t.datetime :locked_at
# Token authenticatable
# t.string :authentication_token
## Invitable
# t.string :invitation_token
t.timestamps
end
add_index :users, :email, :unique => true
add_index :users, :reset_password_token, :unique => true
# add_index :users, :confirmation_token, :unique => true
# add_index :users, :unlock_token, :unique => true
# add_index :users, :authentication_token, :unique => true
end
def self.down
drop_table :users
end
end
class CreateProjects < ActiveRecord::Migration
def change
create_table :projects do |t|
t.string :name
t.string :path
t.text :description
t.timestamps
end
end
end
class CreateUsersProjects < ActiveRecord::Migration
def change
create_table :users_projects do |t|
t.integer :user_id, :null => false
t.integer :project_id, :null => false
t.boolean :read, :default => false
t.boolean :write, :default => false
t.boolean :admin, :default => false
t.timestamps
end
end
end
class AddPrivateFlagToProject < ActiveRecord::Migration
def change
add_column :projects, :private_flag, :boolean, :default => true, :null => false
end
end
class CreateKeys < ActiveRecord::Migration
def change
create_table :keys do |t|
t.integer :user_id, :null => false
t.text :project_id, :null => false
t.timestamps
end
end
end
class AddNameToUser < ActiveRecord::Migration
def change
add_column :users, :name, :string
end
end
class AddKeyTitleToKey < ActiveRecord::Migration
def change
add_column :keys, :key, :text
add_column :keys, :title, :string
remove_column :keys, :project_id
end
end
class AddIdentifierToKey < ActiveRecord::Migration
def change
add_column :keys, :identifier, :string
end
end
class CreateIssues < ActiveRecord::Migration
def change
create_table :issues do |t|
t.string :title
t.text :content
t.integer :assignee_id
t.integer :author_id
t.integer :project_id
t.timestamps
end
end
end
class AddCodeToProject < ActiveRecord::Migration
def change
add_column :projects, :code, :string
end
end
class AddStatusToIssue < ActiveRecord::Migration
def change
add_column :issues, :closed, :boolean, :default => false, :null => false
end
end
class CreateRailsAdminHistoriesTable < ActiveRecord::Migration
def self.up
create_table :rails_admin_histories do |t|
t.text :message # title, name, or object_id
t.string :username
t.integer :item
t.string :table
t.integer :month, :limit => 2
t.integer :year, :limit => 5
t.timestamps
end
add_index(:rails_admin_histories, [:item, :table, :month, :year], :name => 'index_rails_admin_histories' )
end
def self.down
drop_table :rails_admin_histories
end
end
class AddAdminFieldToUser < ActiveRecord::Migration
def change
add_column :users, :admin, :boolean, :default => false, :null => false
end
end
class RemoveAdmin < ActiveRecord::Migration
def up
drop_table :rails_admin_histories
end
def down
raise "No rollback"
end
end
class CreateNotes < ActiveRecord::Migration
def change
create_table :notes do |t|
t.string :note
t.integer :noteable_id
t.string :noteable_type
t.integer :author_id
t.timestamps
end
end
end
class AddProjectIdForNote < ActiveRecord::Migration
def up
add_column :notes, :project_id, :integer
end
def down
remove_column :notes, :project_id, :integer
end
end
class ChangeNoteableIdForNote < ActiveRecord::Migration
def up
change_column :notes, :noteable_id, :string
end
def down
change_column :notes, :noteable_id, :integer
end
end
class AddAttachmentToNote < ActiveRecord::Migration
def change
add_column :notes, :attachment, :string
end
end
class AddAllowRepoCreationForUser < ActiveRecord::Migration
def up
add_column :users, :allowed_create_repo, :boolean, :default => true, :null => false
end
def down
remove_column :users, :allowed_create_repo
end
end
class AddOwnertoProject < ActiveRecord::Migration
def change
add_column :projects, :owner_id, :integer
end
end
class AddProjectsLimitToUser < ActiveRecord::Migration
def change
add_column :users, :projects_limit, :integer, :default => 10
end
end
class RemoveAllowCreateRepoFromUser < ActiveRecord::Migration
def up
remove_column :users, :allowed_create_repo
end
def down
add_column :users, :allowed_create_repo, :boolean, :default => true, :null => false
end
end
class AddPositionToIssues < ActiveRecord::Migration
def change
add_column :issues, :position, :integer, :default => 0
end
end
class CreateSnippets < ActiveRecord::Migration
def change
create_table :snippets do |t|
t.string :title
t.text :content
t.integer :author_id, :null => false
t.integer :project_id, :null => false
t.timestamps
end
end
end
class AddContentTypeToSnippets < ActiveRecord::Migration
def change
add_column :snippets, :content_type, :string, :null => false, :default => "txt"
end
end
class AddFileNameToSnippets < ActiveRecord::Migration
def change
add_column :snippets, :file_name, :string
remove_column :snippets, :content_type
end
end
class AddSocialToUser < ActiveRecord::Migration
def change
add_column :users, :skype, :string
add_column :users, :linkedin, :string
add_column :users, :twitter, :string
end
end
class ChangeSocialFieldsInUsers < ActiveRecord::Migration
def up
remove_column :users, :skype
remove_column :users, :linkedin
remove_column :users, :twitter
add_column :users, :skype, :string, {:null => false, :default => ''}
add_column :users, :linkedin, :string, {:null => false, :default => ''}
add_column :users, :twitter, :string, {:null => false, :default => ''}
end
def down
end
end
class AddHighLabelToIssue < ActiveRecord::Migration
def change
add_column :issues, :critical, :boolean, :default => false, :null => false
end
end
class AddExpiresAtToSnippets < ActiveRecord::Migration
def change
add_column :snippets, :expires_at, :datetime
end
end
class ChangeNoteNoteToText < ActiveRecord::Migration
def up
change_column :notes, :note, :text
end
def down
end
end
class IssueContenToNote < ActiveRecord::Migration
def up
puts "Issue content is deprecated -> move to notes"
Issue.find_each(:batch_size => 100) do |issue|
next if issue.content.blank?
note = Note.new(
:note => issue.content,
:project_id => issue.project_id,
:noteable => issue,
:created_at => issue.created_at,
:updated_at => issue.created_at
)
note.author_id = issue.author_id
if note.save
issue.update_attributes(:content => nil)
print "."
else
print "F"
end
end
total = Issue.where("content is not null").count
if total > 0
puts "content of #{total} issues were not migrated"
else
puts "Done"
end
end
def down
end
end
class ActsAsTaggableOnMigration < ActiveRecord::Migration
def self.up
create_table :tags do |t|
t.string :name
end
create_table :taggings do |t|
t.references :tag
# You should make sure that the column created is
# long enough to store the required class names.
t.references :taggable, :polymorphic => true
t.references :tagger, :polymorphic => true
t.string :context
t.datetime :created_at
end
add_index :taggings, :tag_id
add_index :taggings, [:taggable_id, :taggable_type, :context]
end
def self.down
drop_table :taggings
drop_table :tags
end
end
class RemoveContentFromIssues < ActiveRecord::Migration
def up
remove_column :issues, :content
end
def down
add_column :issues, :content, :text
end
end
class AddAuthenticationTokenToUsers < ActiveRecord::Migration
def change
add_column :users, :authentication_token, :string
end
end
class AddExtraFieldToIssue < ActiveRecord::Migration
def change
add_column :issues, :branch_name, :string, :null => true
end
end
class CreateMergeRequests < ActiveRecord::Migration
def change
create_table :merge_requests do |t|
t.string :target_branch, :null => false
t.string :source_branch, :null => false
t.integer :project_id, :null => false
t.integer :author_id
t.integer :assignee_id
t.string :title
t.boolean :closed, :default => false, :null => false
t.timestamps
end
end
end
class AddAdvancedRightsToTeamMember < ActiveRecord::Migration
def change
add_column :users_projects, :repo_access, :integer, :default => 0, :null => false
add_column :users_projects, :project_access, :integer, :default => 0, :null => false
end
end
class MigrateToNewRights < ActiveRecord::Migration
def up
# Repository access
UsersProject.update_all("repo_access = 2", :write => true)
UsersProject.update_all("repo_access = 1", :read => true, :write => false)
# Project access
UsersProject.update_all("project_access = 1", :read => true, :write => false, :admin => false)
UsersProject.update_all("project_access = 2", :read => true, :write => true, :admin => false)
UsersProject.update_all("project_access = 3", :read => true, :write => true, :admin => true)
# Remove old fields
remove_column :users_projects, :read
remove_column :users_projects, :write
remove_column :users_projects, :admin
end
def down
end
end
class AddDefaultBranchToProject < ActiveRecord::Migration
def change
add_column :projects, :default_branch, :string, :null => false, :default => "master"
end
end
class CreateWebHooks < ActiveRecord::Migration
def change
create_table :web_hooks do |t|
t.string :url
t.integer :project_id
t.timestamps
end
end
end
class AddColoschemeOptionToUser < ActiveRecord::Migration
def change
add_column :users, :dark_scheme, :boolean, :default => false, :null => false
end
end
class AddProjectIdToKey < ActiveRecord::Migration
def change
add_column :keys, :project_id, :integer, :null => true
change_column :keys, :user_id, :integer, :null => true
end
end
class AddLineNumberToNote < ActiveRecord::Migration
def change
add_column :notes, :line_code, :string, :null => true
end
end
class AddIndexes < ActiveRecord::Migration
def change
add_index :issues, :project_id
add_index :merge_requests, :project_id
add_index :notes, :noteable_id
add_index :notes, :noteable_type
end
end
class FixNoteableId < ActiveRecord::Migration
def up
change_column :notes, :noteable_id, :string, :limit => 255
end
def down
end
end
class AddModularityFieldsToProject < ActiveRecord::Migration
def change
add_column :projects, :issues_enabled, :boolean, :null => false, :default => true
add_column :projects, :wall_enabled, :boolean, :null => false, :default => true
add_column :projects, :merge_requests_enabled, :boolean, :null => false, :default => true
end
end
class CreateProtectedBranches < ActiveRecord::Migration
def change
create_table :protected_branches do |t|
t.integer :project_id, :null => false
t.string :name, :null => false
t.timestamps
end
end
end
class MoveToRolesPermissions < ActiveRecord::Migration
def up
repo_n = 0
repo_r = 1
repo_rw = 2
project_rwa = 3
# Build masters and reset repo_access
UsersProject.update_all({:project_access => UsersProject::MASTER, :repo_access => 99 }, ["project_access = ?", project_rwa])
# Build other roles based on repo access
UsersProject.update_all ["project_access = ?", UsersProject::DEVELOPER], ["repo_access = ?", repo_rw]
UsersProject.update_all ["project_access = ?", UsersProject::REPORTER], ["repo_access = ?", repo_r]
UsersProject.update_all ["project_access = ?", UsersProject::GUEST], ["repo_access = ?", repo_n]
remove_column :users_projects, :repo_access
end
def down
end
end
class CreateWikis < ActiveRecord::Migration
def change
create_table :wikis do |t|
t.string :title
t.text :content
t.integer :project_id
t.timestamps
end
end
end
class AddSlugToWiki < ActiveRecord::Migration
def change
add_column :wikis, :slug, :string
end
end
class AddWikiEnabledToProject < ActiveRecord::Migration
def change
add_column :projects, :wiki_enabled, :boolean, :default => true, :null => false
end
end
class AddUserToWiki < ActiveRecord::Migration
def change
add_column :wikis, :user_id, :integer
end
end
class CreateEvents < ActiveRecord::Migration
def change
create_table :events do |t|
t.string :target_type, :null => true
t.integer :target_id, :null => true
t.string :title, :null => true
t.text :data, :null => true
t.integer :project_id, :null => true
t.timestamps
end
end
end
class AddActionToEvent < ActiveRecord::Migration
def change
add_column :events, :action, :integer, :null => true
end
end
class AddThemeToUser < ActiveRecord::Migration
def change
add_column :users, :theme_id, :integer, :null => false, :default => 1
end
end
class AddAuthorIdToEvent < ActiveRecord::Migration
def change
add_column :events, :author_id, :integer, :null => true
end
end
class AddCommitsDiffStoreToMergeRequest < ActiveRecord::Migration
def change
add_column :merge_requests, :st_commits, :text, :null => true
add_column :merge_requests, :st_diffs, :text, :null => true
end
end
class AddMergedToMergeRequest < ActiveRecord::Migration
def change
add_column :merge_requests, :merged, :boolean, :null => false, :default => false
end
end
class AddDescriptionToIssues < ActiveRecord::Migration
def change
add_column :issues, :description, :text
end
end
class AddBioFieldToUser < ActiveRecord::Migration
def change
add_column :users, :bio, :string, :null => true
end
end
class AddAutomergeToMergeRequest < ActiveRecord::Migration
def change
add_column :merge_requests, :state, :integer, :null => false, :default => 1
end
end
class IncreaseMrTextColumnSize < ActiveRecord::Migration
def up
# MYSQL LARGETEXT for merge request
change_column :merge_requests, :st_diffs, :text, :limit => 4294967295
change_column :merge_requests, :st_commits, :text, :limit => 4294967295
end
def down
end
end
class CreateMilestones < ActiveRecord::Migration
def change
create_table :milestones do |t|
t.string :title, :null => false
t.integer :project_id, :null => false
t.text :description
t.date :due_date
t.boolean :closed, :default => false, :null => false
t.timestamps
end
end
end
class AddMilestoneIdToIssue < ActiveRecord::Migration
def change
add_column :issues, :milestone_id, :integer, :null => true
end
end
class AddBlockedFieldToUser < ActiveRecord::Migration
def change
add_column :users, :blocked, :boolean, :null => false, :default => false
end
end
class RemoveCriticalFromIssue < ActiveRecord::Migration
def up
remove_column :issues, :critical
end
def down
add_column :issues, :critical, :boolean, :null => true, :default => false
end
end
class AddLockableToUsers < ActiveRecord::Migration
def change
add_column :users, :failed_attempts, :integer, :default => 0
add_column :users, :locked_at, :datetime
end
end
class AddTypeToWebHook < ActiveRecord::Migration
def change
add_column :web_hooks, :type, :string, :default => "ProjectHook"
end
end
class AddExternAuthProviderToUsers < ActiveRecord::Migration
def change
add_column :users, :extern_uid, :string
add_column :users, :provider, :string
add_index :users, [:extern_uid, :provider], :unique => true
end
end
class SetDefaultBranchDefaultToNil < ActiveRecord::Migration
def up
# Set the default_branch to allow nil, and default it to nil
change_column_null(:projects, :default_branch, true)
change_column_default(:projects, :default_branch, nil)
end
def down
change_column_null(:projects, :default_branch, false)
change_column_default(:projects, :default_branch, 'master')
end
end
class CreateGroups < ActiveRecord::Migration
def change
create_table :groups do |t|
t.string :name, null: false
t.string :code, null: false
t.integer :owner_id, null: false
t.timestamps
end
end
end
class AddGroupIdToProject < ActiveRecord::Migration
def change
add_column :projects, :group_id, :integer
end
end
class PostgresCreateIntegerCast < ActiveRecord::Migration
def up
execute <<-SQL
CREATE CAST (integer AS text) WITH INOUT AS IMPLICIT;
SQL
rescue ActiveRecord::StatementInvalid
end
def down
execute <<-SQL
DROP CAST (integer AS text);
SQL
rescue ActiveRecord::StatementInvalid
end
end
class AddMilestoneIdToMergeRequests < ActiveRecord::Migration
def change
add_column :merge_requests, :milestone_id, :integer, :null => true
end
end
class CreateServices < ActiveRecord::Migration
def change
create_table :services do |t|
t.string :type
t.string :title
t.string :token
t.integer :project_id, null: false
t.timestamps
end
end
end
class AddServiceIdToWebHook < ActiveRecord::Migration
def change
add_column :web_hooks, :service_id, :integer, null: true
end
end
class AddActiveToService < ActiveRecord::Migration
def change
add_column :services, :active, :boolean, default: false, null: false
end
end
class AddProjectUrlToService < ActiveRecord::Migration
def change
add_column :services, :project_url, :string, null: true
end
end
class ConvertGroupToNamespace < ActiveRecord::Migration
def up
rename_table 'groups', 'namespaces'
add_column :namespaces, :type, :string, null: true
# Migrate old groups
Namespace.update_all(type: 'Group')
end
def down
raise 'Rollback is not allowed'
end
end
class AddNamespaceIdToProject < ActiveRecord::Migration
def change
rename_column :projects, :group_id, :namespace_id
end
end
class AddUsernameToUser < ActiveRecord::Migration
def change
add_column :users, :username, :string, null: true
end
end
class RenameCodeToPath < ActiveRecord::Migration
def up
remove_column :projects, :code
rename_column :namespaces, :code, :path
end
def down
add_column :projects, :code, :string
rename_column :namespaces, :path, :code
end
end
class AddEventsIndices < ActiveRecord::Migration
def change
add_index :events, :project_id
add_index :events, :author_id
add_index :events, :action
add_index :events, :target_type
end
end
class MoreIndices < ActiveRecord::Migration
def change
add_index :notes, :project_id
add_index :namespaces, :owner_id
add_index :keys, :user_id
add_index :projects, :namespace_id
add_index :projects, :owner_id
add_index :services, :project_id
add_index :snippets, :project_id
add_index :users_projects, :project_id
# Issues
add_index :issues, :assignee_id
add_index :issues, :milestone_id
add_index :issues, :author_id
# Merge Requests
add_index :merge_requests, :assignee_id
add_index :merge_requests, :milestone_id
add_index :merge_requests, :author_id
end
end
class AddMoreIndexes < ActiveRecord::Migration
def change
add_index :events, :created_at
add_index :events, :target_id
add_index :issues, :closed
add_index :issues, :created_at
add_index :issues, :title
add_index :keys, :identifier
# FIXME: MySQL can't index text columns
#add_index :keys, :key
add_index :keys, :project_id
add_index :merge_requests, :closed
add_index :merge_requests, :created_at
add_index :merge_requests, :source_branch
add_index :merge_requests, :target_branch
add_index :merge_requests, :title
add_index :milestones, :due_date
add_index :milestones, :project_id
add_index :namespaces, :name
add_index :namespaces, :path
add_index :namespaces, :type
add_index :notes, :created_at
add_index :snippets, :created_at
add_index :snippets, :expires_at
add_index :users, :admin
add_index :users, :blocked
add_index :users, :name
add_index :users, :username
add_index :users_projects, :project_access
add_index :users_projects, :user_id
add_index :wikis, :project_id
add_index :wikis, :slug
end
end
class MoveNoteableCommitToOwnField < ActiveRecord::Migration
def up
add_column :notes, :commit_id, :string, null: true
add_column :notes, :new_noteable_id, :integer, null: true
Note.where(noteable_type: 'Commit').update_all('commit_id = noteable_id')
if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL'
Note.where("noteable_type != 'Commit'").update_all('new_noteable_id = CAST (noteable_id AS INTEGER)')
else
Note.where("noteable_type != 'Commit'").update_all('new_noteable_id = noteable_id')
end
remove_column :notes, :noteable_id
rename_column :notes, :new_noteable_id, :noteable_id
end
def down
raise ActiveRecord::IrreversibleMigration
end
end
class IndicesForNotes < ActiveRecord::Migration
def change
add_index :notes, :commit_id
add_index :notes, [:project_id, :noteable_type]
end
end
class CreateUserTeams < ActiveRecord::Migration
def change
create_table :user_teams do |t|
t.string :name
t.string :path
t.integer :owner_id
t.timestamps
end
end
end
class CreateUserTeamProjectRelationships < ActiveRecord::Migration
def change
create_table :user_team_project_relationships do |t|
t.integer :project_id
t.integer :user_team_id
t.integer :greatest_access
t.timestamps
end
end
end
class CreateUserTeamUserRelationships < ActiveRecord::Migration
def change
create_table :user_team_user_relationships do |t|
t.integer :user_id
t.integer :user_team_id
t.boolean :group_admin
t.integer :permission
t.timestamps
end
end
end
class InitSchema < ActiveRecord::Migration
def up
create_table "events", force: true do |t|
t.string "target_type"
t.integer "target_id"
t.string "title"
t.text "data"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "action"
t.integer "author_id"
end
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
create_table "issues", force: true do |t|
t.string "title"
t.integer "assignee_id"
t.integer "author_id"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "closed", default: false, null: false
t.integer "position", default: 0
t.string "branch_name"
t.text "description"
t.integer "milestone_id"
end
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", ["closed"], name: "index_issues_on_closed", using: :btree
add_index "issues", ["created_at"], name: "index_issues_on_created_at", using: :btree
add_index "issues", ["milestone_id"], name: "index_issues_on_milestone_id", using: :btree
add_index "issues", ["project_id"], name: "index_issues_on_project_id", using: :btree
add_index "issues", ["title"], name: "index_issues_on_title", using: :btree
create_table "keys", force: true do |t|
t.integer "user_id"
t.datetime "created_at"
t.datetime "updated_at"
t.text "key"
t.string "title"
t.string "identifier"
t.integer "project_id"
end
add_index "keys", ["identifier"], name: "index_keys_on_identifier", using: :btree
add_index "keys", ["project_id"], name: "index_keys_on_project_id", using: :btree
add_index "keys", ["user_id"], name: "index_keys_on_user_id", using: :btree
create_table "merge_requests", force: true do |t|
t.string "target_branch", null: false
t.string "source_branch", null: false
t.integer "project_id", null: false
t.integer "author_id"
t.integer "assignee_id"
t.string "title"
t.boolean "closed", default: false, null: false
t.datetime "created_at"
t.datetime "updated_at"
t.text "st_commits", limit: 2147483647
t.text "st_diffs", limit: 2147483647
t.boolean "merged", default: false, null: false
t.integer "state", default: 1, null: false
t.integer "milestone_id"
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", ["closed"], name: "index_merge_requests_on_closed", using: :btree
add_index "merge_requests", ["created_at"], name: "index_merge_requests_on_created_at", using: :btree
add_index "merge_requests", ["milestone_id"], name: "index_merge_requests_on_milestone_id", using: :btree
add_index "merge_requests", ["project_id"], name: "index_merge_requests_on_project_id", using: :btree
add_index "merge_requests", ["source_branch"], name: "index_merge_requests_on_source_branch", using: :btree
add_index "merge_requests", ["target_branch"], name: "index_merge_requests_on_target_branch", using: :btree
add_index "merge_requests", ["title"], name: "index_merge_requests_on_title", using: :btree
create_table "milestones", force: true do |t|
t.string "title", null: false
t.integer "project_id", null: false
t.text "description"
t.date "due_date"
t.boolean "closed", default: false, null: false
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "milestones", ["due_date"], name: "index_milestones_on_due_date", using: :btree
add_index "milestones", ["project_id"], name: "index_milestones_on_project_id", using: :btree
create_table "namespaces", force: true do |t|
t.string "name", null: false
t.string "path", null: false
t.integer "owner_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.string "type"
end
add_index "namespaces", ["name"], name: "index_namespaces_on_name", using: :btree
add_index "namespaces", ["owner_id"], name: "index_namespaces_on_owner_id", using: :btree
add_index "namespaces", ["path"], name: "index_namespaces_on_path", using: :btree
add_index "namespaces", ["type"], name: "index_namespaces_on_type", using: :btree
create_table "notes", force: true do |t|
t.text "note"
t.string "noteable_type"
t.integer "author_id"
t.datetime "created_at"
t.datetime "updated_at"
t.integer "project_id"
t.string "attachment"
t.string "line_code"
t.string "commit_id"
t.integer "noteable_id"
end
add_index "notes", ["commit_id"], name: "index_notes_on_commit_id", using: :btree
add_index "notes", ["created_at"], name: "index_notes_on_created_at", 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
create_table "projects", force: true do |t|
t.string "name"
t.string "path"
t.text "description"
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "private_flag", default: true, null: false
t.integer "owner_id"
t.string "default_branch"
t.boolean "issues_enabled", default: true, null: false
t.boolean "wall_enabled", default: true, null: false
t.boolean "merge_requests_enabled", default: true, null: false
t.boolean "wiki_enabled", default: true, null: false
t.integer "namespace_id"
end
add_index "projects", ["namespace_id"], name: "index_projects_on_namespace_id", using: :btree
add_index "projects", ["owner_id"], name: "index_projects_on_owner_id", using: :btree
create_table "protected_branches", force: true do |t|
t.integer "project_id", null: false
t.string "name", null: false
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "services", force: true do |t|
t.string "type"
t.string "title"
t.string "token"
t.integer "project_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.boolean "active", default: false, null: false
t.string "project_url"
end
add_index "services", ["project_id"], name: "index_services_on_project_id", using: :btree
create_table "snippets", force: true do |t|
t.string "title"
t.text "content"
t.integer "author_id", null: false
t.integer "project_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.string "file_name"
t.datetime "expires_at"
end
add_index "snippets", ["created_at"], name: "index_snippets_on_created_at", using: :btree
add_index "snippets", ["expires_at"], name: "index_snippets_on_expires_at", using: :btree
add_index "snippets", ["project_id"], name: "index_snippets_on_project_id", using: :btree
create_table "taggings", force: true do |t|
t.integer "tag_id"
t.integer "taggable_id"
t.string "taggable_type"
t.integer "tagger_id"
t.string "tagger_type"
t.string "context"
t.datetime "created_at"
end
add_index "taggings", ["tag_id"], name: "index_taggings_on_tag_id", using: :btree
add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree
create_table "tags", force: true do |t|
t.string "name"
end
create_table "user_team_project_relationships", force: true do |t|
t.integer "project_id"
t.integer "user_team_id"
t.integer "greatest_access"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "user_team_user_relationships", force: true do |t|
t.integer "user_id"
t.integer "user_team_id"
t.boolean "group_admin"
t.integer "permission"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "user_teams", force: true do |t|
t.string "name"
t.string "path"
t.integer "owner_id"
t.datetime "created_at"
t.datetime "updated_at"
end
create_table "users", force: true do |t|
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.integer "sign_in_count", default: 0
t.datetime "current_sign_in_at"
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
t.datetime "created_at"
t.datetime "updated_at"
t.string "name"
t.boolean "admin", default: false, null: false
t.integer "projects_limit", default: 10
t.string "skype", default: "", null: false
t.string "linkedin", default: "", null: false
t.string "twitter", default: "", null: false
t.string "authentication_token"
t.boolean "dark_scheme", default: false, null: false
t.integer "theme_id", default: 1, null: false
t.string "bio"
t.boolean "blocked", default: false, null: false
t.integer "failed_attempts", default: 0
t.datetime "locked_at"
t.string "extern_uid"
t.string "provider"
t.string "username"
end
add_index "users", ["admin"], name: "index_users_on_admin", using: :btree
add_index "users", ["blocked"], name: "index_users_on_blocked", using: :btree
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_index "users", ["extern_uid", "provider"], name: "index_users_on_extern_uid_and_provider", unique: true, using: :btree
add_index "users", ["name"], name: "index_users_on_name", using: :btree
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
add_index "users", ["username"], name: "index_users_on_username", using: :btree
create_table "users_projects", force: true do |t|
t.integer "user_id", null: false
t.integer "project_id", null: false
t.datetime "created_at"
t.datetime "updated_at"
t.integer "project_access", default: 0, null: false
end
add_index "users_projects", ["project_access"], name: "index_users_projects_on_project_access", using: :btree
add_index "users_projects", ["project_id"], name: "index_users_projects_on_project_id", using: :btree
add_index "users_projects", ["user_id"], name: "index_users_projects_on_user_id", using: :btree
create_table "web_hooks", force: true do |t|
t.string "url"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "type", default: "ProjectHook"
t.integer "service_id"
end
create_table "wikis", force: true do |t|
t.string "title"
t.text "content"
t.integer "project_id"
t.datetime "created_at"
t.datetime "updated_at"
t.string "slug"
t.integer "user_id"
end
add_index "wikis", ["project_id"], name: "index_wikis_on_project_id", using: :btree
add_index "wikis", ["slug"], name: "index_wikis_on_slug", using: :btree
end
def down
raise "Can not revert initial migration"
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment