Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
95c23b2f
Commit
95c23b2f
authored
Nov 19, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Annotated. schema updated
parent
c3b074ac
Changes
31
Show whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
352 additions
and
346 deletions
+352
-346
app/models/event.rb
app/models/event.rb
+16
-17
app/models/group.rb
app/models/group.rb
+12
-13
app/models/issue.rb
app/models/issue.rb
+18
-19
app/models/key.rb
app/models/key.rb
+14
-15
app/models/merge_request.rb
app/models/merge_request.rb
+21
-22
app/models/milestone.rb
app/models/milestone.rb
+14
-15
app/models/note.rb
app/models/note.rb
+16
-17
app/models/project.rb
app/models/project.rb
+22
-22
app/models/project_hook.rb
app/models/project_hook.rb
+7
-8
app/models/protected_branch.rb
app/models/protected_branch.rb
+11
-12
app/models/snippet.rb
app/models/snippet.rb
+15
-16
app/models/system_hook.rb
app/models/system_hook.rb
+12
-13
app/models/user.rb
app/models/user.rb
+34
-35
app/models/users_project.rb
app/models/users_project.rb
+12
-13
app/models/web_hook.rb
app/models/web_hook.rb
+12
-13
app/models/wiki.rb
app/models/wiki.rb
+14
-15
app/views/projects/_form.html.haml
app/views/projects/_form.html.haml
+4
-6
db/schema.rb
db/schema.rb
+11
-1
spec/factories.rb
spec/factories.rb
+12
-0
spec/models/event_spec.rb
spec/models/event_spec.rb
+3
-3
spec/models/group_spec.rb
spec/models/group_spec.rb
+6
-6
spec/models/issue_spec.rb
spec/models/issue_spec.rb
+5
-5
spec/models/key_spec.rb
spec/models/key_spec.rb
+3
-3
spec/models/merge_request_spec.rb
spec/models/merge_request_spec.rb
+11
-11
spec/models/milestone_spec.rb
spec/models/milestone_spec.rb
+6
-6
spec/models/note_spec.rb
spec/models/note_spec.rb
+3
-3
spec/models/project_spec.rb
spec/models/project_spec.rb
+9
-8
spec/models/protected_branch_spec.rb
spec/models/protected_branch_spec.rb
+5
-5
spec/models/snippet_spec.rb
spec/models/snippet_spec.rb
+5
-5
spec/models/system_hook_spec.rb
spec/models/system_hook_spec.rb
+4
-4
spec/models/user_spec.rb
spec/models/user_spec.rb
+15
-15
No files found.
app/models/event.rb
View file @
95c23b2f
# == Schema Information
#
# Table name: events
#
# id :integer not null, primary key
# target_type :string(255)
# target_id :integer
# title :string(255)
# data :text
# project_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# action :integer
# author_id :integer
#
class
Event
<
ActiveRecord
::
Base
include
PushEvent
...
...
@@ -144,20 +160,3 @@ class Event < ActiveRecord::Base
end
end
end
# == Schema Information
#
# Table name: events
#
# id :integer not null, primary key
# target_type :string(255)
# target_id :integer
# title :string(255)
# data :text
# project_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# action :integer
# author_id :integer
#
app/models/group.rb
View file @
95c23b2f
# == Schema Information
#
# Table name: groups
#
# id :integer not null, primary key
# name :string(255) not null
# code :string(255) not null
# owner_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
class
Group
<
ActiveRecord
::
Base
attr_accessible
:code
,
:name
,
:owner_id
...
...
@@ -22,16 +34,3 @@ class Group < ActiveRecord::Base
User
.
joins
(
:users_projects
).
where
(
users_projects:
{
project_id:
project_ids
}).
uniq
end
end
# == Schema Information
#
# Table name: groups
#
# id :integer not null, primary key
# name :string(255) not null
# code :string(255) not null
# owner_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
app/models/issue.rb
View file @
95c23b2f
class
Issue
<
ActiveRecord
::
Base
include
IssueCommonality
include
Votes
attr_accessible
:title
,
:assignee_id
,
:closed
,
:position
,
:description
,
:milestone_id
,
:label_list
,
:author_id_of_changes
acts_as_taggable_on
:labels
validates
:description
,
length:
{
within:
0
..
2000
}
def
self
.
open_for
(
user
)
opened
.
assigned
(
user
)
end
end
# == Schema Information
#
# Table name: issues
...
...
@@ -32,3 +16,18 @@ end
# milestone_id :integer
#
class
Issue
<
ActiveRecord
::
Base
include
IssueCommonality
include
Votes
attr_accessible
:title
,
:assignee_id
,
:closed
,
:position
,
:description
,
:milestone_id
,
:label_list
,
:author_id_of_changes
acts_as_taggable_on
:labels
validates
:description
,
length:
{
within:
0
..
2000
}
def
self
.
open_for
(
user
)
opened
.
assigned
(
user
)
end
end
app/models/key.rb
View file @
95c23b2f
# == Schema Information
#
# Table name: keys
#
# id :integer not null, primary key
# user_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# key :text
# title :string(255)
# identifier :string(255)
# project_id :integer
#
require
'digest/md5'
class
Key
<
ActiveRecord
::
Base
...
...
@@ -67,18 +81,3 @@ class Key < ActiveRecord::Base
Key
.
where
(
identifier:
identifier
).
count
==
0
end
end
# == Schema Information
#
# Table name: keys
#
# id :integer not null, primary key
# user_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# key :text
# title :string(255)
# identifier :string(255)
# project_id :integer
#
app/models/merge_request.rb
View file @
95c23b2f
# == Schema Information
#
# Table name: merge_requests
#
# id :integer not null, primary key
# target_branch :string(255) not null
# source_branch :string(255) not null
# project_id :integer not null
# author_id :integer
# assignee_id :integer
# title :string(255)
# closed :boolean default(FALSE), not null
# created_at :datetime not null
# updated_at :datetime not null
# st_commits :text(2147483647)
# st_diffs :text(2147483647)
# merged :boolean default(FALSE), not null
# state :integer default(1), not null
# milestone_id :integer
#
require
Rails
.
root
.
join
(
"app/models/commit"
)
require
Rails
.
root
.
join
(
"app/roles/static_model"
)
...
...
@@ -198,25 +219,3 @@ class MergeRequest < ActiveRecord::Base
Note
.
where
(
"(noteable_type = 'MergeRequest' AND noteable_id = :mr_id) OR (noteable_type = 'Commit' AND noteable_id IN (:commit_ids))"
,
mr_id:
id
,
commit_ids:
commit_ids
)
end
end
# == Schema Information
#
# Table name: merge_requests
#
# id :integer not null, primary key
# target_branch :string(255) not null
# source_branch :string(255) not null
# project_id :integer not null
# author_id :integer
# assignee_id :integer
# title :string(255)
# closed :boolean default(FALSE), not null
# created_at :datetime not null
# updated_at :datetime not null
# st_commits :text(4294967295
# st_diffs :text(4294967295
# merged :boolean default(FALSE), not null
# state :integer default(1), not null
# milestone_id :integer
#
app/models/milestone.rb
View file @
95c23b2f
# == Schema Information
#
# Table name: milestones
#
# id :integer not null, primary key
# title :string(255) not null
# project_id :integer not null
# description :text
# due_date :date
# closed :boolean default(FALSE), not null
# created_at :datetime not null
# updated_at :datetime not null
#
class
Milestone
<
ActiveRecord
::
Base
attr_accessible
:title
,
:description
,
:due_date
,
:closed
...
...
@@ -39,18 +53,3 @@ class Milestone < ActiveRecord::Base
"expires at
#{
due_date
.
stamp
(
"Aug 21, 2011"
)
}
"
if
due_date
end
end
# == Schema Information
#
# Table name: milestones
#
# id :integer not null, primary key
# title :string(255) not null
# project_id :integer not null
# description :text
# due_date :date
# closed :boolean default(FALSE), not null
# created_at :datetime not null
# updated_at :datetime not null
#
app/models/note.rb
View file @
95c23b2f
# == Schema Information
#
# Table name: notes
#
# id :integer not null, primary key
# note :text
# noteable_id :string(255)
# noteable_type :string(255)
# author_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# project_id :integer
# attachment :string(255)
# line_code :string(255)
#
require
'carrierwave/orm/activerecord'
require
'file_size_validator'
...
...
@@ -107,20 +123,3 @@ class Note < ActiveRecord::Base
note
.
start_with?
(
'-1'
)
||
note
.
start_with?
(
':-1:'
)
end
end
# == Schema Information
#
# Table name: notes
#
# id :integer not null, primary key
# note :text
# noteable_id :string(255)
# noteable_type :string(255)
# author_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# project_id :integer
# attachment :string(255)
# line_code :string(255)
#
app/models/project.rb
View file @
95c23b2f
# == Schema Information
#
# Table name: projects
#
# id :integer not null, primary key
# name :string(255)
# path :string(255)
# description :text
# created_at :datetime not null
# updated_at :datetime not null
# private_flag :boolean default(TRUE), not null
# code :string(255)
# owner_id :integer
# default_branch :string(255)
# issues_enabled :boolean default(TRUE), not null
# wall_enabled :boolean default(TRUE), not null
# merge_requests_enabled :boolean default(TRUE), not null
# wiki_enabled :boolean default(TRUE), not null
# group_id :integer
#
require
"grit"
class
Project
<
ActiveRecord
::
Base
...
...
@@ -26,6 +47,7 @@ class Project < ActiveRecord::Base
has_many
:wikis
,
dependent: :destroy
has_many
:protected_branches
,
dependent: :destroy
has_one
:last_event
,
class_name:
'Event'
,
order:
'events.created_at DESC'
,
foreign_key:
'project_id'
has_many
:services
,
dependent: :destroy
delegate
:name
,
to: :owner
,
allow_nil:
true
,
prefix:
true
...
...
@@ -163,25 +185,3 @@ class Project < ActiveRecord::Base
issues
.
tag_counts_on
(
:labels
)
end
end
# == Schema Information
#
# Table name: projects
#
# id :integer not null, primary key
# name :string(255)
# path :string(255)
# description :text
# created_at :datetime not null
# updated_at :datetime not null
# private_flag :boolean default(TRUE), not null
# code :string(255)
# owner_id :integer
# default_branch :string(255)
# issues_enabled :boolean default(TRUE), not null
# wall_enabled :boolean default(TRUE), not null
# merge_requests_enabled :boolean default(TRUE), not null
# wiki_enabled :boolean default(TRUE), not null
# group_id :integer
#
app/models/project_hook.rb
View file @
95c23b2f
class
ProjectHook
<
WebHook
belongs_to
:project
end
# == Schema Information
#
# Table name: web_hooks
...
...
@@ -14,3 +10,6 @@ end
# type :string(255) default("ProjectHook")
#
class
ProjectHook
<
WebHook
belongs_to
:project
end
app/models/protected_branch.rb
View file @
95c23b2f
# == Schema Information
#
# Table name: protected_branches
#
# id :integer not null, primary key
# project_id :integer not null
# name :string(255) not null
# created_at :datetime not null
# updated_at :datetime not null
#
class
ProtectedBranch
<
ActiveRecord
::
Base
include
GitHost
...
...
@@ -18,15 +29,3 @@ class ProtectedBranch < ActiveRecord::Base
project
.
commit
(
self
.
name
)
end
end
# == Schema Information
#
# Table name: protected_branches
#
# id :integer not null, primary key
# project_id :integer not null
# name :string(255) not null
# created_at :datetime not null
# updated_at :datetime not null
#
app/models/snippet.rb
View file @
95c23b2f
# == Schema Information
#
# Table name: snippets
#
# id :integer not null, primary key
# title :string(255)
# content :text
# author_id :integer not null
# project_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
# file_name :string(255)
# expires_at :datetime
#
class
Snippet
<
ActiveRecord
::
Base
include
Linguist
::
BlobHelper
...
...
@@ -48,19 +63,3 @@ class Snippet < ActiveRecord::Base
expires_at
&&
expires_at
<
Time
.
current
end
end
# == Schema Information
#
# Table name: snippets
#
# id :integer not null, primary key
# title :string(255)
# content :text
# author_id :integer not null
# project_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
# file_name :string(255)
# expires_at :datetime
#
app/models/system_hook.rb
View file @
95c23b2f
class
SystemHook
<
WebHook
def
self
.
all_hooks_fire
(
data
)
SystemHook
.
all
.
each
do
|
sh
|
sh
.
async_execute
data
end
end
def
async_execute
(
data
)
Resque
.
enqueue
(
SystemHookWorker
,
id
,
data
)
end
end
# == Schema Information
#
# Table name: web_hooks
...
...
@@ -22,3 +10,14 @@ end
# type :string(255) default("ProjectHook")
#
class
SystemHook
<
WebHook
def
self
.
all_hooks_fire
(
data
)
SystemHook
.
all
.
each
do
|
sh
|
sh
.
async_execute
data
end
end
def
async_execute
(
data
)
Resque
.
enqueue
(
SystemHookWorker
,
id
,
data
)
end
end
app/models/user.rb
View file @
95c23b2f
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# email :string(255) default(""), not null
# encrypted_password :string(255) default(""), not null
# reset_password_token :string(255)
# reset_password_sent_at :datetime
# remember_created_at :datetime
# sign_in_count :integer default(0)
# current_sign_in_at :datetime
# last_sign_in_at :datetime
# current_sign_in_ip :string(255)
# last_sign_in_ip :string(255)
# created_at :datetime not null
# updated_at :datetime not null
# name :string(255)
# admin :boolean default(FALSE), not null
# projects_limit :integer default(10)
# skype :string(255) default(""), not null
# linkedin :string(255) default(""), not null
# twitter :string(255) default(""), not null
# authentication_token :string(255)
# dark_scheme :boolean default(FALSE), not null
# theme_id :integer default(1), not null
# bio :string(255)
# blocked :boolean default(FALSE), not null
# failed_attempts :integer default(0)
# locked_at :datetime
# extern_uid :string(255)
# provider :string(255)
#
class
User
<
ActiveRecord
::
Base
include
Account
...
...
@@ -79,38 +113,3 @@ class User < ActiveRecord::Base
end
end
end
# == Schema Information
#
# Table name: users
#
# id :integer not null, primary key
# email :string(255) default(""), not null
# encrypted_password :string(128) default(""), not null
# reset_password_token :string(255)
# reset_password_sent_at :datetime
# remember_created_at :datetime
# sign_in_count :integer default(0)
# current_sign_in_at :datetime
# last_sign_in_at :datetime
# current_sign_in_ip :string(255)
# last_sign_in_ip :string(255)
# created_at :datetime not null
# updated_at :datetime not null
# name :string(255)
# admin :boolean default(FALSE), not null
# projects_limit :integer default(10)
# skype :string(255) default(""), not null
# linkedin :string(255) default(""), not null
# twitter :string(255) default(""), not null
# authentication_token :string(255)
# dark_scheme :boolean default(FALSE), not null
# theme_id :integer default(1), not null
# bio :string(255)
# blocked :boolean default(FALSE), not null
# failed_attempts :integer default(0)
# locked_at :datetime
# extern_uid :string(255)
# provider :string(255)
#
app/models/users_project.rb
View file @
95c23b2f
# == Schema Information
#
# Table name: users_projects
#
# id :integer not null, primary key
# user_id :integer not null
# project_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
# project_access :integer default(0), not null
#
class
UsersProject
<
ActiveRecord
::
Base
include
GitHost
...
...
@@ -119,16 +131,3 @@ class UsersProject < ActiveRecord::Base
self
.
class
.
access_roles
.
invert
[
self
.
project_access
]
end
end
# == Schema Information
#
# Table name: users_projects
#
# id :integer not null, primary key
# user_id :integer not null
# project_id :integer not null
# created_at :datetime not null
# updated_at :datetime not null
# project_access :integer default(0), not null
#
app/models/web_hook.rb
View file @
95c23b2f
# == Schema Information
#
# Table name: web_hooks
#
# id :integer not null, primary key
# url :string(255)
# project_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# type :string(255) default("ProjectHook")
#
class
WebHook
<
ActiveRecord
::
Base
include
HTTParty
...
...
@@ -22,16 +34,3 @@ class WebHook < ActiveRecord::Base
end
end
end
# == Schema Information
#
# Table name: web_hooks
#
# id :integer not null, primary key
# url :string(255)
# project_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# type :string(255) default("ProjectHook")
#
app/models/wiki.rb
View file @
95c23b2f
# == Schema Information
#
# Table name: wikis
#
# id :integer not null, primary key
# title :string(255)
# content :text
# project_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# slug :string(255)
# user_id :integer
#
class
Wiki
<
ActiveRecord
::
Base
attr_accessible
:title
,
:content
,
:slug
...
...
@@ -38,18 +52,3 @@ class Wiki < ActiveRecord::Base
end
end
# == Schema Information
#
# Table name: wikis
#
# id :integer not null, primary key
# title :string(255)
# content :text
# project_id :integer
# created_at :datetime not null
# updated_at :datetime not null
# slug :string(255)
# user_id :integer
#
app/views/projects/_form.html.haml
View file @
95c23b2f
...
...
@@ -10,9 +10,8 @@
.input
=
f
.
text_field
:name
,
placeholder:
"Example Project"
,
class:
"xxlarge"
%hr
.adv_settings
%h6
Advanced settings:
%fieldset
%legend
Advanced settings:
.clearfix
=
f
.
label
:path
do
Path
...
...
@@ -34,9 +33,8 @@
.input
=
f
.
select
(
:default_branch
,
@project
.
heads
.
map
(
&
:name
),
{},
style:
"width:210px;"
)
-
unless
@project
.
new_record?
%hr
.adv_settings
%h6
Features:
%fieldset
%legend
Features:
.clearfix
=
f
.
label
:issues_enabled
,
"Issues"
...
...
db/schema.rb
View file @
95c23b2f
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
:version
=>
20121
026114600
)
do
ActiveRecord
::
Schema
.
define
(
:version
=>
20121
120051432
)
do
create_table
"events"
,
:force
=>
true
do
|
t
|
t
.
string
"target_type"
...
...
@@ -127,6 +127,15 @@ ActiveRecord::Schema.define(:version => 20121026114600) do
t
.
datetime
"updated_at"
,
:null
=>
false
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"
,
:null
=>
false
t
.
datetime
"updated_at"
,
:null
=>
false
end
create_table
"snippets"
,
:force
=>
true
do
|
t
|
t
.
string
"title"
t
.
text
"content"
...
...
@@ -203,6 +212,7 @@ ActiveRecord::Schema.define(:version => 20121026114600) do
t
.
datetime
"created_at"
,
:null
=>
false
t
.
datetime
"updated_at"
,
:null
=>
false
t
.
string
"type"
,
:default
=>
"ProjectHook"
t
.
integer
"service_id"
end
create_table
"wikis"
,
:force
=>
true
do
|
t
|
...
...
spec/factories.rb
View file @
95c23b2f
...
...
@@ -132,4 +132,16 @@ FactoryGirl.define do
name
project
end
factory
:service
do
type
""
title
"GitLab CI"
token
"x56olispAND34ng"
project
end
factory
:service_hook
do
url
service
end
end
spec/models/event_spec.rb
View file @
95c23b2f
spec/models/group_spec.rb
View file @
95c23b2f
spec/models/issue_spec.rb
View file @
95c23b2f
spec/models/key_spec.rb
View file @
95c23b2f
spec/models/merge_request_spec.rb
View file @
95c23b2f
...
...
@@ -12,8 +12,8 @@
# closed :boolean default(FALSE), not null
# created_at :datetime not null
# updated_at :datetime not null
# st_commits :text(
4294967295
# st_diffs :text(
4294967295
# st_commits :text(
2147483647)
# st_diffs :text(
2147483647)
# merged :boolean default(FALSE), not null
# state :integer default(1), not null
# milestone_id :integer
...
...
spec/models/milestone_spec.rb
View file @
95c23b2f
spec/models/note_spec.rb
View file @
95c23b2f
spec/models/project_spec.rb
View file @
95c23b2f
...
...
@@ -37,6 +37,7 @@ describe Project do
it
{
should
have_many
(
:hooks
).
dependent
(
:destroy
)
}
it
{
should
have_many
(
:wikis
).
dependent
(
:destroy
)
}
it
{
should
have_many
(
:protected_branches
).
dependent
(
:destroy
)
}
it
{
should
have_many
(
:services
).
dependent
(
:destroy
)
}
end
describe
"Mass assignment"
do
...
...
spec/models/protected_branch_spec.rb
View file @
95c23b2f
spec/models/snippet_spec.rb
View file @
95c23b2f
spec/models/system_hook_spec.rb
View file @
95c23b2f
spec/models/user_spec.rb
View file @
95c23b2f
...
...
@@ -4,7 +4,7 @@
#
# id :integer not null, primary key
# email :string(255) default(""), not null
# encrypted_password :string(
128)
default(""), not null
# encrypted_password :string(
255)
default(""), not null
# reset_password_token :string(255)
# reset_password_sent_at :datetime
# remember_created_at :datetime
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment