Commit 10aa84bd7428fb28fe1dc7923c10f355cbe7fbc7
Exists in
spb-stable
and in
3 other branches
Merge branch 'squashed-migrations' into 'master'
Squashed migrations for 2011 and 2012
Showing
92 changed files
with
306 additions
and
895 deletions
Show diff stats
db/migrate/20110913200833_devise_create_users.rb
@@ -1,55 +0,0 @@ | @@ -1,55 +0,0 @@ | ||
1 | -class DeviseCreateUsers < ActiveRecord::Migration | ||
2 | - def self.up | ||
3 | - create_table(:users) do |t| | ||
4 | - ## Database authenticatable | ||
5 | - t.string :email, :null => false, :default => "" | ||
6 | - t.string :encrypted_password, :null => false, :default => "" | ||
7 | - | ||
8 | - ## Recoverable | ||
9 | - t.string :reset_password_token | ||
10 | - t.datetime :reset_password_sent_at | ||
11 | - | ||
12 | - ## Rememberable | ||
13 | - t.datetime :remember_created_at | ||
14 | - | ||
15 | - ## Trackable | ||
16 | - t.integer :sign_in_count, :default => 0 | ||
17 | - t.datetime :current_sign_in_at | ||
18 | - t.datetime :last_sign_in_at | ||
19 | - t.string :current_sign_in_ip | ||
20 | - t.string :last_sign_in_ip | ||
21 | - | ||
22 | - ## Encryptable | ||
23 | - # t.string :password_salt | ||
24 | - | ||
25 | - ## Confirmable | ||
26 | - # t.string :confirmation_token | ||
27 | - # t.datetime :confirmed_at | ||
28 | - # t.datetime :confirmation_sent_at | ||
29 | - # t.string :unconfirmed_email # Only if using reconfirmable | ||
30 | - | ||
31 | - ## Lockable | ||
32 | - # t.integer :failed_attempts, :default => 0 # Only if lock strategy is :failed_attempts | ||
33 | - # t.string :unlock_token # Only if unlock strategy is :email or :both | ||
34 | - # t.datetime :locked_at | ||
35 | - | ||
36 | - # Token authenticatable | ||
37 | - # t.string :authentication_token | ||
38 | - | ||
39 | - ## Invitable | ||
40 | - # t.string :invitation_token | ||
41 | - | ||
42 | - t.timestamps | ||
43 | - end | ||
44 | - | ||
45 | - add_index :users, :email, :unique => true | ||
46 | - add_index :users, :reset_password_token, :unique => true | ||
47 | - # add_index :users, :confirmation_token, :unique => true | ||
48 | - # add_index :users, :unlock_token, :unique => true | ||
49 | - # add_index :users, :authentication_token, :unique => true | ||
50 | - end | ||
51 | - | ||
52 | - def self.down | ||
53 | - drop_table :users | ||
54 | - end | ||
55 | -end |
db/migrate/20110913204141_create_projects.rb
db/migrate/20110914221600_create_users_projects.rb
@@ -1,13 +0,0 @@ | @@ -1,13 +0,0 @@ | ||
1 | -class CreateUsersProjects < ActiveRecord::Migration | ||
2 | - def change | ||
3 | - create_table :users_projects do |t| | ||
4 | - t.integer :user_id, :null => false | ||
5 | - t.integer :project_id, :null => false | ||
6 | - t.boolean :read, :default => false | ||
7 | - t.boolean :write, :default => false | ||
8 | - t.boolean :admin, :default => false | ||
9 | - | ||
10 | - t.timestamps | ||
11 | - end | ||
12 | - end | ||
13 | -end |
db/migrate/20110915205627_add_private_flag_to_project.rb
db/migrate/20110915213352_create_keys.rb
db/migrate/20110916123731_add_name_to_user.rb
db/migrate/20110916162511_add_key_title_to_key.rb
db/migrate/20110917212932_add_identifier_to_key.rb
db/migrate/20110921192501_create_issues.rb
db/migrate/20110922110156_add_code_to_project.rb
db/migrate/20110923211333_add_status_to_issue.rb
db/migrate/20110924214549_create_rails_admin_histories_table.rb
@@ -1,18 +0,0 @@ | @@ -1,18 +0,0 @@ | ||
1 | -class CreateRailsAdminHistoriesTable < ActiveRecord::Migration | ||
2 | - def self.up | ||
3 | - create_table :rails_admin_histories do |t| | ||
4 | - t.text :message # title, name, or object_id | ||
5 | - t.string :username | ||
6 | - t.integer :item | ||
7 | - t.string :table | ||
8 | - t.integer :month, :limit => 2 | ||
9 | - t.integer :year, :limit => 5 | ||
10 | - t.timestamps | ||
11 | - end | ||
12 | - add_index(:rails_admin_histories, [:item, :table, :month, :year], :name => 'index_rails_admin_histories' ) | ||
13 | - end | ||
14 | - | ||
15 | - def self.down | ||
16 | - drop_table :rails_admin_histories | ||
17 | - end | ||
18 | -end |
db/migrate/20110924215658_add_admin_field_to_user.rb
db/migrate/20110926082616_remove_admin.rb
db/migrate/20110927130352_create_notes.rb
db/migrate/20110928140106_add_project_id_for_note.rb
db/migrate/20110928142747_change_noteable_id_for_note.rb
db/migrate/20110928161328_add_attachment_to_note.rb
db/migrate/20111005193700_add_allow_repo_creation_for_user.rb
db/migrate/20111009101738_add_ownerto_project.rb
db/migrate/20111009110913_add_projects_limit_to_user.rb
db/migrate/20111009111204_remove_allow_create_repo_from_user.rb
db/migrate/20111015154310_add_position_to_issues.rb
db/migrate/20111016183422_create_snippets.rb
@@ -1,12 +0,0 @@ | @@ -1,12 +0,0 @@ | ||
1 | -class CreateSnippets < ActiveRecord::Migration | ||
2 | - def change | ||
3 | - create_table :snippets do |t| | ||
4 | - t.string :title | ||
5 | - t.text :content | ||
6 | - t.integer :author_id, :null => false | ||
7 | - t.integer :project_id, :null => false | ||
8 | - | ||
9 | - t.timestamps | ||
10 | - end | ||
11 | - end | ||
12 | -end |
db/migrate/20111016193417_add_content_type_to_snippets.rb
db/migrate/20111016195506_add_file_name_to_snippets.rb
db/migrate/20111019212429_add_social_to_user.rb
db/migrate/20111021101550_change_social_fields_in_users.rb
@@ -1,14 +0,0 @@ | @@ -1,14 +0,0 @@ | ||
1 | -class ChangeSocialFieldsInUsers < ActiveRecord::Migration | ||
2 | - def up | ||
3 | - remove_column :users, :skype | ||
4 | - remove_column :users, :linkedin | ||
5 | - remove_column :users, :twitter | ||
6 | - | ||
7 | - add_column :users, :skype, :string, {:null => false, :default => ''} | ||
8 | - add_column :users, :linkedin, :string, {:null => false, :default => ''} | ||
9 | - add_column :users, :twitter, :string, {:null => false, :default => ''} | ||
10 | - end | ||
11 | - | ||
12 | - def down | ||
13 | - end | ||
14 | -end |
db/migrate/20111025134235_add_high_label_to_issue.rb
db/migrate/20111027051828_add_expires_at_to_snippets.rb
db/migrate/20111027142641_change_note_note_to_text.rb
db/migrate/20111027152724_issue_conten_to_note.rb
@@ -1,34 +0,0 @@ | @@ -1,34 +0,0 @@ | ||
1 | -class IssueContenToNote < ActiveRecord::Migration | ||
2 | - def up | ||
3 | - puts "Issue content is deprecated -> move to notes" | ||
4 | - Issue.find_each(:batch_size => 100) do |issue| | ||
5 | - next if issue.content.blank? | ||
6 | - note = Note.new( | ||
7 | - :note => issue.content, | ||
8 | - :project_id => issue.project_id, | ||
9 | - :noteable => issue, | ||
10 | - :created_at => issue.created_at, | ||
11 | - :updated_at => issue.created_at | ||
12 | - ) | ||
13 | - note.author_id = issue.author_id | ||
14 | - | ||
15 | - if note.save | ||
16 | - issue.update_attributes(:content => nil) | ||
17 | - print "." | ||
18 | - else | ||
19 | - print "F" | ||
20 | - end | ||
21 | - end | ||
22 | - | ||
23 | - total = Issue.where("content is not null").count | ||
24 | - | ||
25 | - if total > 0 | ||
26 | - puts "content of #{total} issues were not migrated" | ||
27 | - else | ||
28 | - puts "Done" | ||
29 | - end | ||
30 | - end | ||
31 | - | ||
32 | - def down | ||
33 | - end | ||
34 | -end |
db/migrate/20111101222453_acts_as_taggable_on_migration.rb
@@ -1,28 +0,0 @@ | @@ -1,28 +0,0 @@ | ||
1 | -class ActsAsTaggableOnMigration < ActiveRecord::Migration | ||
2 | - def self.up | ||
3 | - create_table :tags do |t| | ||
4 | - t.string :name | ||
5 | - end | ||
6 | - | ||
7 | - create_table :taggings do |t| | ||
8 | - t.references :tag | ||
9 | - | ||
10 | - # You should make sure that the column created is | ||
11 | - # long enough to store the required class names. | ||
12 | - t.references :taggable, :polymorphic => true | ||
13 | - t.references :tagger, :polymorphic => true | ||
14 | - | ||
15 | - t.string :context | ||
16 | - | ||
17 | - t.datetime :created_at | ||
18 | - end | ||
19 | - | ||
20 | - add_index :taggings, :tag_id | ||
21 | - add_index :taggings, [:taggable_id, :taggable_type, :context] | ||
22 | - end | ||
23 | - | ||
24 | - def self.down | ||
25 | - drop_table :taggings | ||
26 | - drop_table :tags | ||
27 | - end | ||
28 | -end |
db/migrate/20111111093150_remove_content_from_issues.rb
db/migrate/20111115063954_add_authentication_token_to_users.rb
db/migrate/20111124115339_add_extra_field_to_issue.rb
db/migrate/20111127155345_create_merge_requests.rb
@@ -1,15 +0,0 @@ | @@ -1,15 +0,0 @@ | ||
1 | -class CreateMergeRequests < ActiveRecord::Migration | ||
2 | - def change | ||
3 | - create_table :merge_requests do |t| | ||
4 | - t.string :target_branch, :null => false | ||
5 | - t.string :source_branch, :null => false | ||
6 | - t.integer :project_id, :null => false | ||
7 | - t.integer :author_id | ||
8 | - t.integer :assignee_id | ||
9 | - t.string :title | ||
10 | - t.boolean :closed, :default => false, :null => false | ||
11 | - | ||
12 | - t.timestamps | ||
13 | - end | ||
14 | - end | ||
15 | -end |
db/migrate/20111206213842_add_advanced_rights_to_team_member.rb
@@ -1,6 +0,0 @@ | @@ -1,6 +0,0 @@ | ||
1 | -class AddAdvancedRightsToTeamMember < ActiveRecord::Migration | ||
2 | - def change | ||
3 | - add_column :users_projects, :repo_access, :integer, :default => 0, :null => false | ||
4 | - add_column :users_projects, :project_access, :integer, :default => 0, :null => false | ||
5 | - end | ||
6 | -end |
db/migrate/20111206222316_migrate_to_new_rights.rb
@@ -1,20 +0,0 @@ | @@ -1,20 +0,0 @@ | ||
1 | -class MigrateToNewRights < ActiveRecord::Migration | ||
2 | - def up | ||
3 | - # Repository access | ||
4 | - UsersProject.update_all("repo_access = 2", :write => true) | ||
5 | - UsersProject.update_all("repo_access = 1", :read => true, :write => false) | ||
6 | - | ||
7 | - # Project access | ||
8 | - UsersProject.update_all("project_access = 1", :read => true, :write => false, :admin => false) | ||
9 | - UsersProject.update_all("project_access = 2", :read => true, :write => true, :admin => false) | ||
10 | - UsersProject.update_all("project_access = 3", :read => true, :write => true, :admin => true) | ||
11 | - | ||
12 | - # Remove old fields | ||
13 | - remove_column :users_projects, :read | ||
14 | - remove_column :users_projects, :write | ||
15 | - remove_column :users_projects, :admin | ||
16 | - end | ||
17 | - | ||
18 | - def down | ||
19 | - end | ||
20 | -end |
db/migrate/20111207211728_add_default_branch_to_project.rb
db/migrate/20111214091851_create_web_hooks.rb
db/migrate/20111220190817_add_coloscheme_option_to_user.rb
db/migrate/20111231111825_add_project_id_to_key.rb
db/migrate/20120110180749_add_line_number_to_note.rb
db/migrate/20120119202326_add_indexes.rb
db/migrate/20120121122616_fix_noteable_id.rb
db/migrate/20120206170141_add_modularity_fields_to_project.rb
@@ -1,7 +0,0 @@ | @@ -1,7 +0,0 @@ | ||
1 | -class AddModularityFieldsToProject < ActiveRecord::Migration | ||
2 | - def change | ||
3 | - add_column :projects, :issues_enabled, :boolean, :null => false, :default => true | ||
4 | - add_column :projects, :wall_enabled, :boolean, :null => false, :default => true | ||
5 | - add_column :projects, :merge_requests_enabled, :boolean, :null => false, :default => true | ||
6 | - end | ||
7 | -end |
db/migrate/20120215182305_create_protected_branches.rb
db/migrate/20120216085842_move_to_roles_permissions.rb
@@ -1,22 +0,0 @@ | @@ -1,22 +0,0 @@ | ||
1 | -class MoveToRolesPermissions < ActiveRecord::Migration | ||
2 | - def up | ||
3 | - repo_n = 0 | ||
4 | - repo_r = 1 | ||
5 | - repo_rw = 2 | ||
6 | - project_rwa = 3 | ||
7 | - | ||
8 | - | ||
9 | - # Build masters and reset repo_access | ||
10 | - UsersProject.update_all({:project_access => UsersProject::MASTER, :repo_access => 99 }, ["project_access = ?", project_rwa]) | ||
11 | - | ||
12 | - # Build other roles based on repo access | ||
13 | - UsersProject.update_all ["project_access = ?", UsersProject::DEVELOPER], ["repo_access = ?", repo_rw] | ||
14 | - UsersProject.update_all ["project_access = ?", UsersProject::REPORTER], ["repo_access = ?", repo_r] | ||
15 | - UsersProject.update_all ["project_access = ?", UsersProject::GUEST], ["repo_access = ?", repo_n] | ||
16 | - | ||
17 | - remove_column :users_projects, :repo_access | ||
18 | - end | ||
19 | - | ||
20 | - def down | ||
21 | - end | ||
22 | -end |
db/migrate/20120216215008_create_wikis.rb
db/migrate/20120219130957_add_slug_to_wiki.rb
db/migrate/20120219140810_add_wiki_enabled_to_project.rb
db/migrate/20120219193300_add_user_to_wiki.rb
db/migrate/20120228130210_create_events.rb
@@ -1,14 +0,0 @@ | @@ -1,14 +0,0 @@ | ||
1 | -class CreateEvents < ActiveRecord::Migration | ||
2 | - def change | ||
3 | - create_table :events do |t| | ||
4 | - t.string :target_type, :null => true | ||
5 | - t.integer :target_id, :null => true | ||
6 | - | ||
7 | - t.string :title, :null => true | ||
8 | - t.text :data, :null => true | ||
9 | - t.integer :project_id, :null => true | ||
10 | - | ||
11 | - t.timestamps | ||
12 | - end | ||
13 | - end | ||
14 | -end |
db/migrate/20120228134252_add_action_to_event.rb
db/migrate/20120301185805_add_theme_to_user.rb
db/migrate/20120307095918_add_author_id_to_event.rb
db/migrate/20120315111711_add_commits_diff_store_to_merge_request.rb
db/migrate/20120315132931_add_merged_to_merge_request.rb
db/migrate/20120317095543_add_description_to_issues.rb
db/migrate/20120323221339_add_bio_field_to_user.rb
db/migrate/20120329170745_add_automerge_to_merge_request.rb
db/migrate/20120405211750_increase_mr_text_column_size.rb
@@ -1,10 +0,0 @@ | @@ -1,10 +0,0 @@ | ||
1 | -class IncreaseMrTextColumnSize < ActiveRecord::Migration | ||
2 | - def up | ||
3 | - # MYSQL LARGETEXT for merge request | ||
4 | - change_column :merge_requests, :st_diffs, :text, :limit => 4294967295 | ||
5 | - change_column :merge_requests, :st_commits, :text, :limit => 4294967295 | ||
6 | - end | ||
7 | - | ||
8 | - def down | ||
9 | - end | ||
10 | -end |
db/migrate/20120408180246_create_milestones.rb
@@ -1,12 +0,0 @@ | @@ -1,12 +0,0 @@ | ||
1 | -class CreateMilestones < ActiveRecord::Migration | ||
2 | - def change | ||
3 | - create_table :milestones do |t| | ||
4 | - t.string :title, :null => false | ||
5 | - t.integer :project_id, :null => false | ||
6 | - t.text :description | ||
7 | - t.date :due_date | ||
8 | - t.boolean :closed, :default => false, :null => false | ||
9 | - t.timestamps | ||
10 | - end | ||
11 | - end | ||
12 | -end |
db/migrate/20120408181910_add_milestone_id_to_issue.rb
db/migrate/20120413135904_add_blocked_field_to_user.rb
db/migrate/20120627145613_remove_critical_from_issue.rb
db/migrate/20120706065612_add_lockable_to_users.rb
db/migrate/20120712080407_add_type_to_web_hook.rb
db/migrate/20120729131232_add_extern_auth_provider_to_users.rb
db/migrate/20120905043334_set_default_branch_default_to_nil.rb
@@ -1,12 +0,0 @@ | @@ -1,12 +0,0 @@ | ||
1 | -class SetDefaultBranchDefaultToNil < ActiveRecord::Migration | ||
2 | - def up | ||
3 | - # Set the default_branch to allow nil, and default it to nil | ||
4 | - change_column_null(:projects, :default_branch, true) | ||
5 | - change_column_default(:projects, :default_branch, nil) | ||
6 | - end | ||
7 | - | ||
8 | - def down | ||
9 | - change_column_null(:projects, :default_branch, false) | ||
10 | - change_column_default(:projects, :default_branch, 'master') | ||
11 | - end | ||
12 | -end |
db/migrate/20121002150926_create_groups.rb
db/migrate/20121002151033_add_group_id_to_project.rb
db/migrate/20121009205010_postgres_create_integer_cast.rb
@@ -1,15 +0,0 @@ | @@ -1,15 +0,0 @@ | ||
1 | -class PostgresCreateIntegerCast < ActiveRecord::Migration | ||
2 | - def up | ||
3 | - execute <<-SQL | ||
4 | - CREATE CAST (integer AS text) WITH INOUT AS IMPLICIT; | ||
5 | - SQL | ||
6 | - rescue ActiveRecord::StatementInvalid | ||
7 | - end | ||
8 | - | ||
9 | - def down | ||
10 | - execute <<-SQL | ||
11 | - DROP CAST (integer AS text); | ||
12 | - SQL | ||
13 | - rescue ActiveRecord::StatementInvalid | ||
14 | - end | ||
15 | -end |
db/migrate/20121026114600_add_milestone_id_to_merge_requests.rb
db/migrate/20121119170638_create_services.rb
db/migrate/20121120051432_add_service_id_to_web_hook.rb
db/migrate/20121120103700_add_active_to_service.rb
db/migrate/20121120113838_add_project_url_to_service.rb
db/migrate/20121122145155_convert_group_to_namespace.rb
@@ -1,13 +0,0 @@ | @@ -1,13 +0,0 @@ | ||
1 | -class ConvertGroupToNamespace < ActiveRecord::Migration | ||
2 | - def up | ||
3 | - rename_table 'groups', 'namespaces' | ||
4 | - add_column :namespaces, :type, :string, null: true | ||
5 | - | ||
6 | - # Migrate old groups | ||
7 | - Namespace.update_all(type: 'Group') | ||
8 | - end | ||
9 | - | ||
10 | - def down | ||
11 | - raise 'Rollback is not allowed' | ||
12 | - end | ||
13 | -end |
db/migrate/20121122150932_add_namespace_id_to_project.rb
db/migrate/20121123104937_add_username_to_user.rb
db/migrate/20121123164910_rename_code_to_path.rb
@@ -1,11 +0,0 @@ | @@ -1,11 +0,0 @@ | ||
1 | -class RenameCodeToPath < ActiveRecord::Migration | ||
2 | - def up | ||
3 | - remove_column :projects, :code | ||
4 | - rename_column :namespaces, :code, :path | ||
5 | - end | ||
6 | - | ||
7 | - def down | ||
8 | - add_column :projects, :code, :string | ||
9 | - rename_column :namespaces, :path, :code | ||
10 | - end | ||
11 | -end |
db/migrate/20121203154450_add_events_indices.rb
db/migrate/20121203160507_more_indices.rb
@@ -1,26 +0,0 @@ | @@ -1,26 +0,0 @@ | ||
1 | -class MoreIndices < ActiveRecord::Migration | ||
2 | - def change | ||
3 | - add_index :notes, :project_id | ||
4 | - add_index :namespaces, :owner_id | ||
5 | - add_index :keys, :user_id | ||
6 | - | ||
7 | - add_index :projects, :namespace_id | ||
8 | - add_index :projects, :owner_id | ||
9 | - | ||
10 | - add_index :services, :project_id | ||
11 | - add_index :snippets, :project_id | ||
12 | - | ||
13 | - add_index :users_projects, :project_id | ||
14 | - | ||
15 | - # Issues | ||
16 | - add_index :issues, :assignee_id | ||
17 | - add_index :issues, :milestone_id | ||
18 | - add_index :issues, :author_id | ||
19 | - | ||
20 | - # Merge Requests | ||
21 | - add_index :merge_requests, :assignee_id | ||
22 | - add_index :merge_requests, :milestone_id | ||
23 | - add_index :merge_requests, :author_id | ||
24 | - | ||
25 | - end | ||
26 | -end |
db/migrate/20121205201726_add_more_indexes.rb
@@ -1,44 +0,0 @@ | @@ -1,44 +0,0 @@ | ||
1 | -class AddMoreIndexes < ActiveRecord::Migration | ||
2 | - def change | ||
3 | - add_index :events, :created_at | ||
4 | - add_index :events, :target_id | ||
5 | - | ||
6 | - add_index :issues, :closed | ||
7 | - add_index :issues, :created_at | ||
8 | - add_index :issues, :title | ||
9 | - | ||
10 | - add_index :keys, :identifier | ||
11 | - # FIXME: MySQL can't index text columns | ||
12 | - #add_index :keys, :key | ||
13 | - add_index :keys, :project_id | ||
14 | - | ||
15 | - add_index :merge_requests, :closed | ||
16 | - add_index :merge_requests, :created_at | ||
17 | - add_index :merge_requests, :source_branch | ||
18 | - add_index :merge_requests, :target_branch | ||
19 | - add_index :merge_requests, :title | ||
20 | - | ||
21 | - add_index :milestones, :due_date | ||
22 | - add_index :milestones, :project_id | ||
23 | - | ||
24 | - add_index :namespaces, :name | ||
25 | - add_index :namespaces, :path | ||
26 | - add_index :namespaces, :type | ||
27 | - | ||
28 | - add_index :notes, :created_at | ||
29 | - | ||
30 | - add_index :snippets, :created_at | ||
31 | - add_index :snippets, :expires_at | ||
32 | - | ||
33 | - add_index :users, :admin | ||
34 | - add_index :users, :blocked | ||
35 | - add_index :users, :name | ||
36 | - add_index :users, :username | ||
37 | - | ||
38 | - add_index :users_projects, :project_access | ||
39 | - add_index :users_projects, :user_id | ||
40 | - | ||
41 | - add_index :wikis, :project_id | ||
42 | - add_index :wikis, :slug | ||
43 | - end | ||
44 | -end |
db/migrate/20121218164840_move_noteable_commit_to_own_field.rb
@@ -1,20 +0,0 @@ | @@ -1,20 +0,0 @@ | ||
1 | -class MoveNoteableCommitToOwnField < ActiveRecord::Migration | ||
2 | - def up | ||
3 | - add_column :notes, :commit_id, :string, null: true | ||
4 | - add_column :notes, :new_noteable_id, :integer, null: true | ||
5 | - Note.where(noteable_type: 'Commit').update_all('commit_id = noteable_id') | ||
6 | - | ||
7 | - if ActiveRecord::Base.connection.adapter_name == 'PostgreSQL' | ||
8 | - Note.where("noteable_type != 'Commit'").update_all('new_noteable_id = CAST (noteable_id AS INTEGER)') | ||
9 | - else | ||
10 | - Note.where("noteable_type != 'Commit'").update_all('new_noteable_id = noteable_id') | ||
11 | - end | ||
12 | - | ||
13 | - remove_column :notes, :noteable_id | ||
14 | - rename_column :notes, :new_noteable_id, :noteable_id | ||
15 | - end | ||
16 | - | ||
17 | - def down | ||
18 | - raise ActiveRecord::IrreversibleMigration | ||
19 | - end | ||
20 | -end |
db/migrate/20121219095402_indices_for_notes.rb
db/migrate/20121219183753_create_user_teams.rb
db/migrate/20121220064104_create_user_team_project_relationships.rb
@@ -1,11 +0,0 @@ | @@ -1,11 +0,0 @@ | ||
1 | -class CreateUserTeamProjectRelationships < ActiveRecord::Migration | ||
2 | - def change | ||
3 | - create_table :user_team_project_relationships do |t| | ||
4 | - t.integer :project_id | ||
5 | - t.integer :user_team_id | ||
6 | - t.integer :greatest_access | ||
7 | - | ||
8 | - t.timestamps | ||
9 | - end | ||
10 | - end | ||
11 | -end |
db/migrate/20121220064453_create_user_team_user_relationships.rb
@@ -1,12 +0,0 @@ | @@ -1,12 +0,0 @@ | ||
1 | -class CreateUserTeamUserRelationships < ActiveRecord::Migration | ||
2 | - def change | ||
3 | - create_table :user_team_user_relationships do |t| | ||
4 | - t.integer :user_id | ||
5 | - t.integer :user_team_id | ||
6 | - t.boolean :group_admin | ||
7 | - t.integer :permission | ||
8 | - | ||
9 | - t.timestamps | ||
10 | - end | ||
11 | - end | ||
12 | -end |
@@ -0,0 +1,306 @@ | @@ -0,0 +1,306 @@ | ||
1 | +class InitSchema < ActiveRecord::Migration | ||
2 | + def up | ||
3 | + | ||
4 | + create_table "events", force: true do |t| | ||
5 | + t.string "target_type" | ||
6 | + t.integer "target_id" | ||
7 | + t.string "title" | ||
8 | + t.text "data" | ||
9 | + t.integer "project_id" | ||
10 | + t.datetime "created_at" | ||
11 | + t.datetime "updated_at" | ||
12 | + t.integer "action" | ||
13 | + t.integer "author_id" | ||
14 | + end | ||
15 | + | ||
16 | + add_index "events", ["action"], name: "index_events_on_action", using: :btree | ||
17 | + add_index "events", ["author_id"], name: "index_events_on_author_id", using: :btree | ||
18 | + add_index "events", ["created_at"], name: "index_events_on_created_at", using: :btree | ||
19 | + add_index "events", ["project_id"], name: "index_events_on_project_id", using: :btree | ||
20 | + add_index "events", ["target_id"], name: "index_events_on_target_id", using: :btree | ||
21 | + add_index "events", ["target_type"], name: "index_events_on_target_type", using: :btree | ||
22 | + | ||
23 | + create_table "issues", force: true do |t| | ||
24 | + t.string "title" | ||
25 | + t.integer "assignee_id" | ||
26 | + t.integer "author_id" | ||
27 | + t.integer "project_id" | ||
28 | + t.datetime "created_at" | ||
29 | + t.datetime "updated_at" | ||
30 | + t.boolean "closed", default: false, null: false | ||
31 | + t.integer "position", default: 0 | ||
32 | + t.string "branch_name" | ||
33 | + t.text "description" | ||
34 | + t.integer "milestone_id" | ||
35 | + end | ||
36 | + | ||
37 | + add_index "issues", ["assignee_id"], name: "index_issues_on_assignee_id", using: :btree | ||
38 | + add_index "issues", ["author_id"], name: "index_issues_on_author_id", using: :btree | ||
39 | + add_index "issues", ["closed"], name: "index_issues_on_closed", using: :btree | ||
40 | + add_index "issues", ["created_at"], name: "index_issues_on_created_at", using: :btree | ||
41 | + add_index "issues", ["milestone_id"], name: "index_issues_on_milestone_id", using: :btree | ||
42 | + add_index "issues", ["project_id"], name: "index_issues_on_project_id", using: :btree | ||
43 | + add_index "issues", ["title"], name: "index_issues_on_title", using: :btree | ||
44 | + | ||
45 | + create_table "keys", force: true do |t| | ||
46 | + t.integer "user_id" | ||
47 | + t.datetime "created_at" | ||
48 | + t.datetime "updated_at" | ||
49 | + t.text "key" | ||
50 | + t.string "title" | ||
51 | + t.string "identifier" | ||
52 | + t.integer "project_id" | ||
53 | + end | ||
54 | + | ||
55 | + add_index "keys", ["identifier"], name: "index_keys_on_identifier", using: :btree | ||
56 | + add_index "keys", ["project_id"], name: "index_keys_on_project_id", using: :btree | ||
57 | + add_index "keys", ["user_id"], name: "index_keys_on_user_id", using: :btree | ||
58 | + | ||
59 | + create_table "merge_requests", force: true do |t| | ||
60 | + t.string "target_branch", null: false | ||
61 | + t.string "source_branch", null: false | ||
62 | + t.integer "project_id", null: false | ||
63 | + t.integer "author_id" | ||
64 | + t.integer "assignee_id" | ||
65 | + t.string "title" | ||
66 | + t.boolean "closed", default: false, null: false | ||
67 | + t.datetime "created_at" | ||
68 | + t.datetime "updated_at" | ||
69 | + t.text "st_commits", limit: 2147483647 | ||
70 | + t.text "st_diffs", limit: 2147483647 | ||
71 | + t.boolean "merged", default: false, null: false | ||
72 | + t.integer "state", default: 1, null: false | ||
73 | + t.integer "milestone_id" | ||
74 | + end | ||
75 | + | ||
76 | + add_index "merge_requests", ["assignee_id"], name: "index_merge_requests_on_assignee_id", using: :btree | ||
77 | + add_index "merge_requests", ["author_id"], name: "index_merge_requests_on_author_id", using: :btree | ||
78 | + add_index "merge_requests", ["closed"], name: "index_merge_requests_on_closed", using: :btree | ||
79 | + add_index "merge_requests", ["created_at"], name: "index_merge_requests_on_created_at", using: :btree | ||
80 | + add_index "merge_requests", ["milestone_id"], name: "index_merge_requests_on_milestone_id", using: :btree | ||
81 | + add_index "merge_requests", ["project_id"], name: "index_merge_requests_on_project_id", using: :btree | ||
82 | + add_index "merge_requests", ["source_branch"], name: "index_merge_requests_on_source_branch", using: :btree | ||
83 | + add_index "merge_requests", ["target_branch"], name: "index_merge_requests_on_target_branch", using: :btree | ||
84 | + add_index "merge_requests", ["title"], name: "index_merge_requests_on_title", using: :btree | ||
85 | + | ||
86 | + create_table "milestones", force: true do |t| | ||
87 | + t.string "title", null: false | ||
88 | + t.integer "project_id", null: false | ||
89 | + t.text "description" | ||
90 | + t.date "due_date" | ||
91 | + t.boolean "closed", default: false, null: false | ||
92 | + t.datetime "created_at" | ||
93 | + t.datetime "updated_at" | ||
94 | + end | ||
95 | + | ||
96 | + add_index "milestones", ["due_date"], name: "index_milestones_on_due_date", using: :btree | ||
97 | + add_index "milestones", ["project_id"], name: "index_milestones_on_project_id", using: :btree | ||
98 | + | ||
99 | + create_table "namespaces", force: true do |t| | ||
100 | + t.string "name", null: false | ||
101 | + t.string "path", null: false | ||
102 | + t.integer "owner_id", null: false | ||
103 | + t.datetime "created_at" | ||
104 | + t.datetime "updated_at" | ||
105 | + t.string "type" | ||
106 | + end | ||
107 | + | ||
108 | + add_index "namespaces", ["name"], name: "index_namespaces_on_name", using: :btree | ||
109 | + add_index "namespaces", ["owner_id"], name: "index_namespaces_on_owner_id", using: :btree | ||
110 | + add_index "namespaces", ["path"], name: "index_namespaces_on_path", using: :btree | ||
111 | + add_index "namespaces", ["type"], name: "index_namespaces_on_type", using: :btree | ||
112 | + | ||
113 | + create_table "notes", force: true do |t| | ||
114 | + t.text "note" | ||
115 | + t.string "noteable_type" | ||
116 | + t.integer "author_id" | ||
117 | + t.datetime "created_at" | ||
118 | + t.datetime "updated_at" | ||
119 | + t.integer "project_id" | ||
120 | + t.string "attachment" | ||
121 | + t.string "line_code" | ||
122 | + t.string "commit_id" | ||
123 | + t.integer "noteable_id" | ||
124 | + end | ||
125 | + | ||
126 | + add_index "notes", ["commit_id"], name: "index_notes_on_commit_id", using: :btree | ||
127 | + add_index "notes", ["created_at"], name: "index_notes_on_created_at", using: :btree | ||
128 | + add_index "notes", ["noteable_type"], name: "index_notes_on_noteable_type", using: :btree | ||
129 | + add_index "notes", ["project_id", "noteable_type"], name: "index_notes_on_project_id_and_noteable_type", using: :btree | ||
130 | + add_index "notes", ["project_id"], name: "index_notes_on_project_id", using: :btree | ||
131 | + | ||
132 | + create_table "projects", force: true do |t| | ||
133 | + t.string "name" | ||
134 | + t.string "path" | ||
135 | + t.text "description" | ||
136 | + t.datetime "created_at" | ||
137 | + t.datetime "updated_at" | ||
138 | + t.boolean "private_flag", default: true, null: false | ||
139 | + t.integer "owner_id" | ||
140 | + t.string "default_branch" | ||
141 | + t.boolean "issues_enabled", default: true, null: false | ||
142 | + t.boolean "wall_enabled", default: true, null: false | ||
143 | + t.boolean "merge_requests_enabled", default: true, null: false | ||
144 | + t.boolean "wiki_enabled", default: true, null: false | ||
145 | + t.integer "namespace_id" | ||
146 | + end | ||
147 | + | ||
148 | + add_index "projects", ["namespace_id"], name: "index_projects_on_namespace_id", using: :btree | ||
149 | + add_index "projects", ["owner_id"], name: "index_projects_on_owner_id", using: :btree | ||
150 | + | ||
151 | + create_table "protected_branches", force: true do |t| | ||
152 | + t.integer "project_id", null: false | ||
153 | + t.string "name", null: false | ||
154 | + t.datetime "created_at" | ||
155 | + t.datetime "updated_at" | ||
156 | + end | ||
157 | + | ||
158 | + create_table "services", force: true do |t| | ||
159 | + t.string "type" | ||
160 | + t.string "title" | ||
161 | + t.string "token" | ||
162 | + t.integer "project_id", null: false | ||
163 | + t.datetime "created_at" | ||
164 | + t.datetime "updated_at" | ||
165 | + t.boolean "active", default: false, null: false | ||
166 | + t.string "project_url" | ||
167 | + end | ||
168 | + | ||
169 | + add_index "services", ["project_id"], name: "index_services_on_project_id", using: :btree | ||
170 | + | ||
171 | + create_table "snippets", force: true do |t| | ||
172 | + t.string "title" | ||
173 | + t.text "content" | ||
174 | + t.integer "author_id", null: false | ||
175 | + t.integer "project_id", null: false | ||
176 | + t.datetime "created_at" | ||
177 | + t.datetime "updated_at" | ||
178 | + t.string "file_name" | ||
179 | + t.datetime "expires_at" | ||
180 | + end | ||
181 | + | ||
182 | + add_index "snippets", ["created_at"], name: "index_snippets_on_created_at", using: :btree | ||
183 | + add_index "snippets", ["expires_at"], name: "index_snippets_on_expires_at", using: :btree | ||
184 | + add_index "snippets", ["project_id"], name: "index_snippets_on_project_id", using: :btree | ||
185 | + | ||
186 | + create_table "taggings", force: true do |t| | ||
187 | + t.integer "tag_id" | ||
188 | + t.integer "taggable_id" | ||
189 | + t.string "taggable_type" | ||
190 | + t.integer "tagger_id" | ||
191 | + t.string "tagger_type" | ||
192 | + t.string "context" | ||
193 | + t.datetime "created_at" | ||
194 | + end | ||
195 | + | ||
196 | + add_index "taggings", ["tag_id"], name: "index_taggings_on_tag_id", using: :btree | ||
197 | + add_index "taggings", ["taggable_id", "taggable_type", "context"], name: "index_taggings_on_taggable_id_and_taggable_type_and_context", using: :btree | ||
198 | + | ||
199 | + create_table "tags", force: true do |t| | ||
200 | + t.string "name" | ||
201 | + end | ||
202 | + | ||
203 | + create_table "user_team_project_relationships", force: true do |t| | ||
204 | + t.integer "project_id" | ||
205 | + t.integer "user_team_id" | ||
206 | + t.integer "greatest_access" | ||
207 | + t.datetime "created_at" | ||
208 | + t.datetime "updated_at" | ||
209 | + end | ||
210 | + | ||
211 | + create_table "user_team_user_relationships", force: true do |t| | ||
212 | + t.integer "user_id" | ||
213 | + t.integer "user_team_id" | ||
214 | + t.boolean "group_admin" | ||
215 | + t.integer "permission" | ||
216 | + t.datetime "created_at" | ||
217 | + t.datetime "updated_at" | ||
218 | + end | ||
219 | + | ||
220 | + create_table "user_teams", force: true do |t| | ||
221 | + t.string "name" | ||
222 | + t.string "path" | ||
223 | + t.integer "owner_id" | ||
224 | + t.datetime "created_at" | ||
225 | + t.datetime "updated_at" | ||
226 | + end | ||
227 | + | ||
228 | + create_table "users", force: true do |t| | ||
229 | + t.string "email", default: "", null: false | ||
230 | + t.string "encrypted_password", default: "", null: false | ||
231 | + t.string "reset_password_token" | ||
232 | + t.datetime "reset_password_sent_at" | ||
233 | + t.datetime "remember_created_at" | ||
234 | + t.integer "sign_in_count", default: 0 | ||
235 | + t.datetime "current_sign_in_at" | ||
236 | + t.datetime "last_sign_in_at" | ||
237 | + t.string "current_sign_in_ip" | ||
238 | + t.string "last_sign_in_ip" | ||
239 | + t.datetime "created_at" | ||
240 | + t.datetime "updated_at" | ||
241 | + t.string "name" | ||
242 | + t.boolean "admin", default: false, null: false | ||
243 | + t.integer "projects_limit", default: 10 | ||
244 | + t.string "skype", default: "", null: false | ||
245 | + t.string "linkedin", default: "", null: false | ||
246 | + t.string "twitter", default: "", null: false | ||
247 | + t.string "authentication_token" | ||
248 | + t.boolean "dark_scheme", default: false, null: false | ||
249 | + t.integer "theme_id", default: 1, null: false | ||
250 | + t.string "bio" | ||
251 | + t.boolean "blocked", default: false, null: false | ||
252 | + t.integer "failed_attempts", default: 0 | ||
253 | + t.datetime "locked_at" | ||
254 | + t.string "extern_uid" | ||
255 | + t.string "provider" | ||
256 | + t.string "username" | ||
257 | + end | ||
258 | + | ||
259 | + add_index "users", ["admin"], name: "index_users_on_admin", using: :btree | ||
260 | + add_index "users", ["blocked"], name: "index_users_on_blocked", using: :btree | ||
261 | + add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree | ||
262 | + add_index "users", ["extern_uid", "provider"], name: "index_users_on_extern_uid_and_provider", unique: true, using: :btree | ||
263 | + add_index "users", ["name"], name: "index_users_on_name", using: :btree | ||
264 | + add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree | ||
265 | + add_index "users", ["username"], name: "index_users_on_username", using: :btree | ||
266 | + | ||
267 | + create_table "users_projects", force: true do |t| | ||
268 | + t.integer "user_id", null: false | ||
269 | + t.integer "project_id", null: false | ||
270 | + t.datetime "created_at" | ||
271 | + t.datetime "updated_at" | ||
272 | + t.integer "project_access", default: 0, null: false | ||
273 | + end | ||
274 | + | ||
275 | + add_index "users_projects", ["project_access"], name: "index_users_projects_on_project_access", using: :btree | ||
276 | + add_index "users_projects", ["project_id"], name: "index_users_projects_on_project_id", using: :btree | ||
277 | + add_index "users_projects", ["user_id"], name: "index_users_projects_on_user_id", using: :btree | ||
278 | + | ||
279 | + create_table "web_hooks", force: true do |t| | ||
280 | + t.string "url" | ||
281 | + t.integer "project_id" | ||
282 | + t.datetime "created_at" | ||
283 | + t.datetime "updated_at" | ||
284 | + t.string "type", default: "ProjectHook" | ||
285 | + t.integer "service_id" | ||
286 | + end | ||
287 | + | ||
288 | + create_table "wikis", force: true do |t| | ||
289 | + t.string "title" | ||
290 | + t.text "content" | ||
291 | + t.integer "project_id" | ||
292 | + t.datetime "created_at" | ||
293 | + t.datetime "updated_at" | ||
294 | + t.string "slug" | ||
295 | + t.integer "user_id" | ||
296 | + end | ||
297 | + | ||
298 | + add_index "wikis", ["project_id"], name: "index_wikis_on_project_id", using: :btree | ||
299 | + add_index "wikis", ["slug"], name: "index_wikis_on_slug", using: :btree | ||
300 | + | ||
301 | + end | ||
302 | + | ||
303 | + def down | ||
304 | + raise "Can not revert initial migration" | ||
305 | + end | ||
306 | +end |