summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorgitlabhq <m@gitlabhq.com>2011-10-09 00:36:38 +0300
committergitlabhq <m@gitlabhq.com>2011-10-09 00:36:38 +0300
commit9ba1224867665844b117fa037e1465bb706b3685 (patch)
tree52fbfc1cdb55df21843965479c97be0c91121a9a /db
parent93efff945215a4407afcaf0cba15ac601b56df0d (diff)
downloadgitlab-ce-9ba1224867665844b117fa037e1465bb706b3685.tar.gz
init commit
Diffstat (limited to 'db')
-rw-r--r--db/fixtures/development/001_admin.rb10
-rw-r--r--db/fixtures/production/001_admin.rb9
-rw-r--r--db/fixtures/test/001_repo.rb8
-rw-r--r--db/migrate/20110913200833_devise_create_users.rb28
-rw-r--r--db/migrate/20110913204141_create_projects.rb11
-rw-r--r--db/migrate/20110914221600_create_users_projects.rb13
-rw-r--r--db/migrate/20110915205627_add_private_flag_to_project.rb5
-rw-r--r--db/migrate/20110915213352_create_keys.rb9
-rw-r--r--db/migrate/20110916123731_add_name_to_user.rb5
-rw-r--r--db/migrate/20110916162511_add_key_title_to_key.rb7
-rw-r--r--db/migrate/20110917212932_add_identifier_to_key.rb5
-rw-r--r--db/migrate/20110921192501_create_issues.rb13
-rw-r--r--db/migrate/20110922110156_add_code_to_project.rb5
-rw-r--r--db/migrate/20110923211333_add_status_to_issue.rb5
-rw-r--r--db/migrate/20110924214549_create_rails_admin_histories_table.rb18
-rw-r--r--db/migrate/20110924215658_add_admin_field_to_user.rb5
-rw-r--r--db/migrate/20110926082616_remove_admin.rb9
-rw-r--r--db/migrate/20110927130352_create_notes.rb12
-rw-r--r--db/migrate/20110928140106_add_project_id_for_note.rb9
-rw-r--r--db/migrate/20110928142747_change_noteable_id_for_note.rb9
-rw-r--r--db/migrate/20110928161328_add_attachment_to_note.rb5
-rw-r--r--db/migrate/20111005193700_add_allow_repo_creation_for_user.rb9
-rw-r--r--db/pkey.example3
-rw-r--r--db/schema.rb88
-rw-r--r--db/seeds.rb0
25 files changed, 300 insertions, 0 deletions
diff --git a/db/fixtures/development/001_admin.rb b/db/fixtures/development/001_admin.rb
new file mode 100644
index 00000000000..5020eccbca4
--- /dev/null
+++ b/db/fixtures/development/001_admin.rb
@@ -0,0 +1,10 @@
+# Admin account
+admin = User.create(
+ :email => "admin@local.host",
+ :name => "Administrator",
+ :password => "5iveL!fe",
+ :password_confirmation => "5iveL!fe"
+)
+
+admin.admin = true
+admin.save!
diff --git a/db/fixtures/production/001_admin.rb b/db/fixtures/production/001_admin.rb
new file mode 100644
index 00000000000..a50a693632b
--- /dev/null
+++ b/db/fixtures/production/001_admin.rb
@@ -0,0 +1,9 @@
+admin = User.create(
+ :email => "admin@local.host",
+ :name => "Administrator",
+ :password => "5iveL!fe",
+ :password_confirmation => "5iveL!fe"
+)
+
+admin.admin = true
+admin.save!
diff --git a/db/fixtures/test/001_repo.rb b/db/fixtures/test/001_repo.rb
new file mode 100644
index 00000000000..034596f1cbf
--- /dev/null
+++ b/db/fixtures/test/001_repo.rb
@@ -0,0 +1,8 @@
+# Clone repo
+`cp spec/seed_project.tar.gz /tmp/`
+Dir.chdir("/tmp")
+`tar -xf seed_project.tar.gz`
+3.times do |i|
+`cp -r /tmp/legit/ /tmp/legit_#{i}/`
+puts "Unpacked seed repo - /tmp/legit_#{i}"
+end
diff --git a/db/migrate/20110913200833_devise_create_users.rb b/db/migrate/20110913200833_devise_create_users.rb
new file mode 100644
index 00000000000..3083e742459
--- /dev/null
+++ b/db/migrate/20110913200833_devise_create_users.rb
@@ -0,0 +1,28 @@
+class DeviseCreateUsers < ActiveRecord::Migration
+ def self.up
+ create_table(:users) do |t|
+ t.database_authenticatable :null => false
+ t.recoverable
+ t.rememberable
+ t.trackable
+
+ # t.encryptable
+ # t.confirmable
+ # t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
+ # t.token_authenticatable
+
+
+ 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
diff --git a/db/migrate/20110913204141_create_projects.rb b/db/migrate/20110913204141_create_projects.rb
new file mode 100644
index 00000000000..45b76f95563
--- /dev/null
+++ b/db/migrate/20110913204141_create_projects.rb
@@ -0,0 +1,11 @@
+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
diff --git a/db/migrate/20110914221600_create_users_projects.rb b/db/migrate/20110914221600_create_users_projects.rb
new file mode 100644
index 00000000000..a89798ae86f
--- /dev/null
+++ b/db/migrate/20110914221600_create_users_projects.rb
@@ -0,0 +1,13 @@
+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
diff --git a/db/migrate/20110915205627_add_private_flag_to_project.rb b/db/migrate/20110915205627_add_private_flag_to_project.rb
new file mode 100644
index 00000000000..73c0b9df834
--- /dev/null
+++ b/db/migrate/20110915205627_add_private_flag_to_project.rb
@@ -0,0 +1,5 @@
+class AddPrivateFlagToProject < ActiveRecord::Migration
+ def change
+ add_column :projects, :private_flag, :boolean, :default => true, :null => false
+ end
+end
diff --git a/db/migrate/20110915213352_create_keys.rb b/db/migrate/20110915213352_create_keys.rb
new file mode 100644
index 00000000000..d4615b4babf
--- /dev/null
+++ b/db/migrate/20110915213352_create_keys.rb
@@ -0,0 +1,9 @@
+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
diff --git a/db/migrate/20110916123731_add_name_to_user.rb b/db/migrate/20110916123731_add_name_to_user.rb
new file mode 100644
index 00000000000..74142b05cb5
--- /dev/null
+++ b/db/migrate/20110916123731_add_name_to_user.rb
@@ -0,0 +1,5 @@
+class AddNameToUser < ActiveRecord::Migration
+ def change
+ add_column :users, :name, :string
+ end
+end
diff --git a/db/migrate/20110916162511_add_key_title_to_key.rb b/db/migrate/20110916162511_add_key_title_to_key.rb
new file mode 100644
index 00000000000..b2eaa51cccf
--- /dev/null
+++ b/db/migrate/20110916162511_add_key_title_to_key.rb
@@ -0,0 +1,7 @@
+class AddKeyTitleToKey < ActiveRecord::Migration
+ def change
+ add_column :keys, :key, :text
+ add_column :keys, :title, :string
+ remove_column :keys, :project_id
+ end
+end
diff --git a/db/migrate/20110917212932_add_identifier_to_key.rb b/db/migrate/20110917212932_add_identifier_to_key.rb
new file mode 100644
index 00000000000..e572793952a
--- /dev/null
+++ b/db/migrate/20110917212932_add_identifier_to_key.rb
@@ -0,0 +1,5 @@
+class AddIdentifierToKey < ActiveRecord::Migration
+ def change
+ add_column :keys, :identifier, :string
+ end
+end
diff --git a/db/migrate/20110921192501_create_issues.rb b/db/migrate/20110921192501_create_issues.rb
new file mode 100644
index 00000000000..63b42ad998e
--- /dev/null
+++ b/db/migrate/20110921192501_create_issues.rb
@@ -0,0 +1,13 @@
+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
diff --git a/db/migrate/20110922110156_add_code_to_project.rb b/db/migrate/20110922110156_add_code_to_project.rb
new file mode 100644
index 00000000000..f54a02bd70a
--- /dev/null
+++ b/db/migrate/20110922110156_add_code_to_project.rb
@@ -0,0 +1,5 @@
+class AddCodeToProject < ActiveRecord::Migration
+ def change
+ add_column :projects, :code, :string
+ end
+end
diff --git a/db/migrate/20110923211333_add_status_to_issue.rb b/db/migrate/20110923211333_add_status_to_issue.rb
new file mode 100644
index 00000000000..c53bf46ef72
--- /dev/null
+++ b/db/migrate/20110923211333_add_status_to_issue.rb
@@ -0,0 +1,5 @@
+class AddStatusToIssue < ActiveRecord::Migration
+ def change
+ add_column :issues, :closed, :boolean, :default => false, :null => false
+ end
+end
diff --git a/db/migrate/20110924214549_create_rails_admin_histories_table.rb b/db/migrate/20110924214549_create_rails_admin_histories_table.rb
new file mode 100644
index 00000000000..3c743aa2874
--- /dev/null
+++ b/db/migrate/20110924214549_create_rails_admin_histories_table.rb
@@ -0,0 +1,18 @@
+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
diff --git a/db/migrate/20110924215658_add_admin_field_to_user.rb b/db/migrate/20110924215658_add_admin_field_to_user.rb
new file mode 100644
index 00000000000..321587e6957
--- /dev/null
+++ b/db/migrate/20110924215658_add_admin_field_to_user.rb
@@ -0,0 +1,5 @@
+class AddAdminFieldToUser < ActiveRecord::Migration
+ def change
+ add_column :users, :admin, :boolean, :default => false, :null => false
+ end
+end
diff --git a/db/migrate/20110926082616_remove_admin.rb b/db/migrate/20110926082616_remove_admin.rb
new file mode 100644
index 00000000000..aac9ff7888c
--- /dev/null
+++ b/db/migrate/20110926082616_remove_admin.rb
@@ -0,0 +1,9 @@
+class RemoveAdmin < ActiveRecord::Migration
+ def up
+ drop_table :rails_admin_histories
+ end
+
+ def down
+ raise "No rollback"
+ end
+end
diff --git a/db/migrate/20110927130352_create_notes.rb b/db/migrate/20110927130352_create_notes.rb
new file mode 100644
index 00000000000..72a0e817617
--- /dev/null
+++ b/db/migrate/20110927130352_create_notes.rb
@@ -0,0 +1,12 @@
+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
diff --git a/db/migrate/20110928140106_add_project_id_for_note.rb b/db/migrate/20110928140106_add_project_id_for_note.rb
new file mode 100644
index 00000000000..3e641089799
--- /dev/null
+++ b/db/migrate/20110928140106_add_project_id_for_note.rb
@@ -0,0 +1,9 @@
+class AddProjectIdForNote < ActiveRecord::Migration
+ def up
+ add_column :notes, :project_id, :integer
+ end
+
+ def down
+ remove_column :notes, :project_id, :integer
+ end
+end
diff --git a/db/migrate/20110928142747_change_noteable_id_for_note.rb b/db/migrate/20110928142747_change_noteable_id_for_note.rb
new file mode 100644
index 00000000000..dc9d1f0171a
--- /dev/null
+++ b/db/migrate/20110928142747_change_noteable_id_for_note.rb
@@ -0,0 +1,9 @@
+class ChangeNoteableIdForNote < ActiveRecord::Migration
+ def up
+ change_column :notes, :noteable_id, :string
+ end
+
+ def down
+ change_column :notes, :noteable_id, :integer
+ end
+end
diff --git a/db/migrate/20110928161328_add_attachment_to_note.rb b/db/migrate/20110928161328_add_attachment_to_note.rb
new file mode 100644
index 00000000000..37d9cf10258
--- /dev/null
+++ b/db/migrate/20110928161328_add_attachment_to_note.rb
@@ -0,0 +1,5 @@
+class AddAttachmentToNote < ActiveRecord::Migration
+ def change
+ add_column :notes, :attachment, :string
+ end
+end
diff --git a/db/migrate/20111005193700_add_allow_repo_creation_for_user.rb b/db/migrate/20111005193700_add_allow_repo_creation_for_user.rb
new file mode 100644
index 00000000000..82bd94b8089
--- /dev/null
+++ b/db/migrate/20111005193700_add_allow_repo_creation_for_user.rb
@@ -0,0 +1,9 @@
+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
diff --git a/db/pkey.example b/db/pkey.example
new file mode 100644
index 00000000000..ae045772430
--- /dev/null
+++ b/db/pkey.example
@@ -0,0 +1,3 @@
+AAAAB3NzaC1yc2EAAAABJQAAAIEAiPWx6WM4lhHNedGfBpPJNPpZ7yKu+dnn1SJejgt4
+596k6YjzGGphH2TUxwKzxcKDKKezwkpfnxPkSMkuEspGRt/aZZ9wa++Oi7Qkr8prgHc4
+soW6NUlfDzpvZK2H5E7eQaSeP3SAwGmQKUFHCddNaP0L+hM7zhFNzjFvpaMgJw0=
diff --git a/db/schema.rb b/db/schema.rb
new file mode 100644
index 00000000000..eda4b8050ed
--- /dev/null
+++ b/db/schema.rb
@@ -0,0 +1,88 @@
+# encoding: UTF-8
+# This file is auto-generated from the current state of the database. Instead
+# of editing this file, please use the migrations feature of Active Record to
+# incrementally modify your database, and then regenerate this schema definition.
+#
+# Note that this schema.rb definition is the authoritative source for your
+# database schema. If you need to create the application database on another
+# system, you should be using db:schema:load, not running all the migrations
+# from scratch. The latter is a flawed and unsustainable approach (the more migrations
+# you'll amass, the slower it'll run and the greater likelihood for issues).
+#
+# It's strongly recommended to check this file into your version control system.
+
+ActiveRecord::Schema.define(:version => 20111005193700) do
+
+ create_table "issues", :force => true do |t|
+ t.string "title"
+ t.text "content"
+ 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
+ end
+
+ create_table "keys", :force => true do |t|
+ t.integer "user_id", :null => false
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.text "key"
+ t.string "title"
+ t.string "identifier"
+ end
+
+ create_table "notes", :force => true do |t|
+ t.string "note"
+ t.string "noteable_id"
+ t.string "noteable_type"
+ t.integer "author_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ t.integer "project_id"
+ t.string "attachment"
+ end
+
+ 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.string "code"
+ end
+
+ create_table "users", :force => true do |t|
+ 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.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.boolean "allowed_create_repo", :default => true, :null => false
+ end
+
+ add_index "users", ["email"], :name => "index_users_on_email", :unique => true
+ add_index "users", ["reset_password_token"], :name => "index_users_on_reset_password_token", :unique => true
+
+ create_table "users_projects", :force => true 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.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+end
diff --git a/db/seeds.rb b/db/seeds.rb
new file mode 100644
index 00000000000..e69de29bb2d
--- /dev/null
+++ b/db/seeds.rb