Commit d5cfabcc03b588c7ae34aa52fb34622e8acce52f

models annotated

Commit diff

app/models/comment.rb

 
1# == Schema Information
2#
3# Table name: comments
4#
5# id :integer not null, primary key
6# user_id :integer not null
7# repository_id :integer not null
8# sha1 :string(255) not null
9# body :text
10# created_at :datetime
11# updated_at :datetime
12#
13
114class Comment < ActiveRecord::Base
215 belongs_to :user
316 belongs_to :repository
toggle raw diff

app/models/committership.rb

 
1# == Schema Information
2#
3# Table name: committerships
4#
5# id :integer not null, primary key
6# user_id :integer
7# repository_id :integer
8# kind :integer default(2)
9# created_at :datetime
10# updated_at :datetime
11#
12
113class Committership < ActiveRecord::Base
214 belongs_to :user
315 belongs_to :repository
toggle raw diff

app/models/project.rb

 
1# == Schema Information
2#
3# Table name: projects
4#
5# id :integer not null, primary key
6# title :string(255)
7# description :text
8# user_id :integer
9# created_at :datetime
10# updated_at :datetime
11# slug :string(255)
12# license :string(255)
13# home_url :string(255)
14# mailinglist_url :string(255)
15# bugtracker_url :string(255)
16#
17
118class Project < ActiveRecord::Base
219 acts_as_taggable
320
toggle raw diff

app/models/repository.rb

 
1# == Schema Information
2#
3# Table name: repositories
4#
5# id :integer not null, primary key
6# name :string(255)
7# project_id :integer
8# user_id :integer
9# created_at :datetime
10# updated_at :datetime
11# mainline :boolean
12# parent_id :integer
13# ready :boolean
14#
15
116class Repository < ActiveRecord::Base
217 belongs_to :user
318 belongs_to :project
toggle raw diff

app/models/ssh_key.rb

 
1# == Schema Information
2#
3# Table name: ssh_keys
4#
5# id :integer not null, primary key
6# user_id :integer
7# key :text
8# created_at :datetime
9# updated_at :datetime
10# ready :boolean
11#
12
113class SshKey < ActiveRecord::Base
214 belongs_to :user
315
toggle raw diff

app/models/task.rb

 
1# == Schema Information
2#
3# Table name: tasks
4#
5# id :integer not null, primary key
6# target_class :string(255)
7# command :string(255)
8# arguments :text
9# performed :boolean
10# performed_at :datetime
11# created_at :datetime
12# updated_at :datetime
13# target_id :integer
14#
15
116class Task < ActiveRecord::Base
217 serialize :arguments, Array
318
toggle raw diff

app/models/user.rb

 
1# == Schema Information
2#
3# Table name: users
4#
5# id :integer not null, primary key
6# login :string(255)
7# email :string(255)
8# crypted_password :string(40)
9# salt :string(40)
10# created_at :datetime
11# updated_at :datetime
12# remember_token :string(255)
13# remember_token_expires_at :datetime
14# activation_code :string(40)
15# activated_at :datetime
16# ssh_key_id :integer
17# fullname :string(255)
18# url :text
19#
20
121require 'digest/sha1'
222
323class User < ActiveRecord::Base
toggle raw diff

db/development_structure.sql

 
1--
2-- PostgreSQL database dump
3--
4
5SET client_encoding = 'UTF8';
6SET standard_conforming_strings = off;
7SET check_function_bodies = false;
8SET client_min_messages = warning;
9SET escape_string_warning = off;
10
11--
12-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: -
13--
14
15COMMENT ON SCHEMA public IS 'Standard public schema';
16
17
18SET search_path = public, pg_catalog;
19
20SET default_tablespace = '';
21
22SET default_with_oids = false;
23
24--
25-- Name: comments; Type: TABLE; Schema: public; Owner: -; Tablespace:
26--
27
28CREATE TABLE comments (
29 id integer NOT NULL,
30 user_id integer NOT NULL,
31 repository_id integer NOT NULL,
32 sha1 character varying(255) NOT NULL,
33 body text,
34 created_at timestamp without time zone,
35 updated_at timestamp without time zone
36);
37
38
39--
40-- Name: comments_id_seq; Type: SEQUENCE; Schema: public; Owner: -
41--
42
43CREATE SEQUENCE comments_id_seq
44 START WITH 4
45 INCREMENT BY 1
46 NO MAXVALUE
47 NO MINVALUE
48 CACHE 1;
49
50
51--
52-- Name: comments_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
53--
54
55ALTER SEQUENCE comments_id_seq OWNED BY comments.id;
56
57
58--
59-- Name: committerships; Type: TABLE; Schema: public; Owner: -; Tablespace:
60--
61
62CREATE TABLE committerships (
63 id integer NOT NULL,
64 user_id integer,
65 repository_id integer,
66 kind integer DEFAULT 2,
67 created_at timestamp without time zone,
68 updated_at timestamp without time zone
69);
70
71
72--
73-- Name: permissions_id_seq; Type: SEQUENCE; Schema: public; Owner: -
74--
75
76CREATE SEQUENCE permissions_id_seq
77 START WITH 3
78 INCREMENT BY 1
79 NO MAXVALUE
80 NO MINVALUE
81 CACHE 1;
82
83
84--
85-- Name: permissions_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
86--
87
88ALTER SEQUENCE permissions_id_seq OWNED BY committerships.id;
89
90
91--
92-- Name: projects; Type: TABLE; Schema: public; Owner: -; Tablespace:
93--
94
95CREATE TABLE projects (
96 id integer NOT NULL,
97 title character varying(255),
98 description text,
99 user_id integer,
100 created_at timestamp without time zone,
101 updated_at timestamp without time zone,
102 slug character varying(255),
103 license character varying(255),
104 home_url character varying(255),
105 mailinglist_url character varying(255),
106 bugtracker_url character varying(255)
107);
108
109
110--
111-- Name: projects_id_seq; Type: SEQUENCE; Schema: public; Owner: -
112--
113
114CREATE SEQUENCE projects_id_seq
115 START WITH 3
116 INCREMENT BY 1
117 NO MAXVALUE
118 NO MINVALUE
119 CACHE 1;
120
121
122--
123-- Name: projects_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
124--
125
126ALTER SEQUENCE projects_id_seq OWNED BY projects.id;
127
128
129--
130-- Name: repositories; Type: TABLE; Schema: public; Owner: -; Tablespace:
131--
132
133CREATE TABLE repositories (
134 id integer NOT NULL,
135 name character varying(255),
136 project_id integer,
137 user_id integer,
138 created_at timestamp without time zone,
139 updated_at timestamp without time zone,
140 mainline boolean DEFAULT false,
141 parent_id integer,
142 ready boolean DEFAULT false
143);
144
145
146--
147-- Name: repositories_id_seq; Type: SEQUENCE; Schema: public; Owner: -
148--
149
150CREATE SEQUENCE repositories_id_seq
151 START WITH 4
152 INCREMENT BY 1
153 NO MAXVALUE
154 NO MINVALUE
155 CACHE 1;
156
157
158--
159-- Name: repositories_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
160--
161
162ALTER SEQUENCE repositories_id_seq OWNED BY repositories.id;
163
164
165--
166-- Name: schema_info; Type: TABLE; Schema: public; Owner: -; Tablespace:
167--
168
169CREATE TABLE schema_info (
170 version integer
171);
172
173
174--
175-- Name: ssh_keys; Type: TABLE; Schema: public; Owner: -; Tablespace:
176--
177
178CREATE TABLE ssh_keys (
179 id integer NOT NULL,
180 user_id integer,
181 "key" text,
182 created_at timestamp without time zone,
183 updated_at timestamp without time zone,
184 ready boolean DEFAULT false
185);
186
187
188--
189-- Name: ssh_keys_id_seq; Type: SEQUENCE; Schema: public; Owner: -
190--
191
192CREATE SEQUENCE ssh_keys_id_seq
193 START WITH 3
194 INCREMENT BY 1
195 NO MAXVALUE
196 NO MINVALUE
197 CACHE 1;
198
199
200--
201-- Name: ssh_keys_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
202--
203
204ALTER SEQUENCE ssh_keys_id_seq OWNED BY ssh_keys.id;
205
206
207--
208-- Name: taggings; Type: TABLE; Schema: public; Owner: -; Tablespace:
209--
210
211CREATE TABLE taggings (
212 id integer NOT NULL,
213 tag_id integer,
214 taggable_id integer,
215 taggable_type character varying(255),
216 created_at timestamp without time zone
217);
218
219
220--
221-- Name: taggings_id_seq; Type: SEQUENCE; Schema: public; Owner: -
222--
223
224CREATE SEQUENCE taggings_id_seq
225 START WITH 1
226 INCREMENT BY 1
227 NO MAXVALUE
228 NO MINVALUE
229 CACHE 1;
230
231
232--
233-- Name: taggings_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
234--
235
236ALTER SEQUENCE taggings_id_seq OWNED BY taggings.id;
237
238
239--
240-- Name: tags; Type: TABLE; Schema: public; Owner: -; Tablespace:
241--
242
243CREATE TABLE tags (
244 id integer NOT NULL,
245 name character varying(255)
246);
247
248
249--
250-- Name: tags_id_seq; Type: SEQUENCE; Schema: public; Owner: -
251--
252
253CREATE SEQUENCE tags_id_seq
254 START WITH 1
255 INCREMENT BY 1
256 NO MAXVALUE
257 NO MINVALUE
258 CACHE 1;
259
260
261--
262-- Name: tags_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
263--
264
265ALTER SEQUENCE tags_id_seq OWNED BY tags.id;
266
267
268--
269-- Name: tasks; Type: TABLE; Schema: public; Owner: -; Tablespace:
270--
271
272CREATE TABLE tasks (
273 id integer NOT NULL,
274 target_class character varying(255),
275 command character varying(255),
276 arguments text,
277 performed boolean DEFAULT false,
278 performed_at timestamp without time zone,
279 created_at timestamp without time zone,
280 updated_at timestamp without time zone,
281 target_id integer
282);
283
284
285--
286-- Name: tasks_id_seq; Type: SEQUENCE; Schema: public; Owner: -
287--
288
289CREATE SEQUENCE tasks_id_seq
290 START WITH 3
291 INCREMENT BY 1
292 NO MAXVALUE
293 NO MINVALUE
294 CACHE 1;
295
296
297--
298-- Name: tasks_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
299--
300
301ALTER SEQUENCE tasks_id_seq OWNED BY tasks.id;
302
303
304--
305-- Name: users; Type: TABLE; Schema: public; Owner: -; Tablespace:
306--
307
308CREATE TABLE users (
309 id integer NOT NULL,
310 "login" character varying(255),
311 email character varying(255),
312 crypted_password character varying(40),
313 salt character varying(40),
314 created_at timestamp without time zone,
315 updated_at timestamp without time zone,
316 remember_token character varying(255),
317 remember_token_expires_at timestamp without time zone,
318 activation_code character varying(40),
319 activated_at timestamp without time zone,
320 ssh_key_id integer,
321 fullname character varying(255),
322 url text
323);
324
325
326--
327-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: -
328--
329
330CREATE SEQUENCE users_id_seq
331 START WITH 3
332 INCREMENT BY 1
333 NO MAXVALUE
334 NO MINVALUE
335 CACHE 1;
336
337
338--
339-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: -
340--
341
342ALTER SEQUENCE users_id_seq OWNED BY users.id;
343
344
345--
346-- Name: id; Type: DEFAULT; Schema: public; Owner: -
347--
348
349ALTER TABLE comments ALTER COLUMN id SET DEFAULT nextval('comments_id_seq'::regclass);
350
351
352--
353-- Name: id; Type: DEFAULT; Schema: public; Owner: -
354--
355
356ALTER TABLE committerships ALTER COLUMN id SET DEFAULT nextval('permissions_id_seq'::regclass);
357
358
359--
360-- Name: id; Type: DEFAULT; Schema: public; Owner: -
361--
362
363ALTER TABLE projects ALTER COLUMN id SET DEFAULT nextval('projects_id_seq'::regclass);
364
365
366--
367-- Name: id; Type: DEFAULT; Schema: public; Owner: -
368--
369
370ALTER TABLE repositories ALTER COLUMN id SET DEFAULT nextval('repositories_id_seq'::regclass);
371
372
373--
374-- Name: id; Type: DEFAULT; Schema: public; Owner: -
375--
376
377ALTER TABLE ssh_keys ALTER COLUMN id SET DEFAULT nextval('ssh_keys_id_seq'::regclass);
378
379
380--
381-- Name: id; Type: DEFAULT; Schema: public; Owner: -
382--
383
384ALTER TABLE taggings ALTER COLUMN id SET DEFAULT nextval('taggings_id_seq'::regclass);
385
386
387--
388-- Name: id; Type: DEFAULT; Schema: public; Owner: -
389--
390
391ALTER TABLE tags ALTER COLUMN id SET DEFAULT nextval('tags_id_seq'::regclass);
392
393
394--
395-- Name: id; Type: DEFAULT; Schema: public; Owner: -
396--
397
398ALTER TABLE tasks ALTER COLUMN id SET DEFAULT nextval('tasks_id_seq'::regclass);
399
400
401--
402-- Name: id; Type: DEFAULT; Schema: public; Owner: -
403--
404
405ALTER TABLE users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);
406
407
408--
409-- Name: comments_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
410--
411
412ALTER TABLE ONLY comments
413 ADD CONSTRAINT comments_pkey PRIMARY KEY (id);
414
415
416--
417-- Name: permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
418--
419
420ALTER TABLE ONLY committerships
421 ADD CONSTRAINT permissions_pkey PRIMARY KEY (id);
422
423
424--
425-- Name: projects_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
426--
427
428ALTER TABLE ONLY projects
429 ADD CONSTRAINT projects_pkey PRIMARY KEY (id);
430
431
432--
433-- Name: repositories_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
434--
435
436ALTER TABLE ONLY repositories
437 ADD CONSTRAINT repositories_pkey PRIMARY KEY (id);
438
439
440--
441-- Name: ssh_keys_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
442--
443
444ALTER TABLE ONLY ssh_keys
445 ADD CONSTRAINT ssh_keys_pkey PRIMARY KEY (id);
446
447
448--
449-- Name: taggings_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
450--
451
452ALTER TABLE ONLY taggings
453 ADD CONSTRAINT taggings_pkey PRIMARY KEY (id);
454
455
456--
457-- Name: tags_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
458--
459
460ALTER TABLE ONLY tags
461 ADD CONSTRAINT tags_pkey PRIMARY KEY (id);
462
463
464--
465-- Name: tasks_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
466--
467
468ALTER TABLE ONLY tasks
469 ADD CONSTRAINT tasks_pkey PRIMARY KEY (id);
470
471
472--
473-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: -; Tablespace:
474--
475
476ALTER TABLE ONLY users
477 ADD CONSTRAINT users_pkey PRIMARY KEY (id);
478
479
480--
481-- Name: index_comments_on_repository_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
482--
483
484CREATE INDEX index_comments_on_repository_id ON comments USING btree (repository_id);
485
486
487--
488-- Name: index_comments_on_sha1; Type: INDEX; Schema: public; Owner: -; Tablespace:
489--
490
491CREATE INDEX index_comments_on_sha1 ON comments USING btree (sha1);
492
493
494--
495-- Name: index_comments_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
496--
497
498CREATE INDEX index_comments_on_user_id ON comments USING btree (user_id);
499
500
501--
502-- Name: index_permissions_on_repository_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
503--
504
505CREATE INDEX index_permissions_on_repository_id ON committerships USING btree (repository_id);
506
507
508--
509-- Name: index_permissions_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
510--
511
512CREATE INDEX index_permissions_on_user_id ON committerships USING btree (user_id);
513
514
515--
516-- Name: index_projects_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
517--
518
519CREATE INDEX index_projects_on_name ON projects USING btree (title);
520
521
522--
523-- Name: index_projects_on_slug; Type: INDEX; Schema: public; Owner: -; Tablespace:
524--
525
526CREATE UNIQUE INDEX index_projects_on_slug ON projects USING btree (slug);
527
528
529--
530-- Name: index_projects_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
531--
532
533CREATE INDEX index_projects_on_user_id ON projects USING btree (user_id);
534
535
536--
537-- Name: index_repositories_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
538--
539
540CREATE INDEX index_repositories_on_name ON repositories USING btree (name);
541
542
543--
544-- Name: index_repositories_on_parent_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
545--
546
547CREATE INDEX index_repositories_on_parent_id ON repositories USING btree (parent_id);
548
549
550--
551-- Name: index_repositories_on_project_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
552--
553
554CREATE INDEX index_repositories_on_project_id ON repositories USING btree (project_id);
555
556
557--
558-- Name: index_repositories_on_ready; Type: INDEX; Schema: public; Owner: -; Tablespace:
559--
560
561CREATE INDEX index_repositories_on_ready ON repositories USING btree (ready);
562
563
564--
565-- Name: index_repositories_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
566--
567
568CREATE INDEX index_repositories_on_user_id ON repositories USING btree (user_id);
569
570
571--
572-- Name: index_ssh_keys_on_user_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
573--
574
575CREATE INDEX index_ssh_keys_on_user_id ON ssh_keys USING btree (user_id);
576
577
578--
579-- Name: index_taggings_on_tag_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
580--
581
582CREATE INDEX index_taggings_on_tag_id ON taggings USING btree (tag_id);
583
584
585--
586-- Name: index_taggings_on_taggable_id_and_taggable_type; Type: INDEX; Schema: public; Owner: -; Tablespace:
587--
588
589CREATE INDEX index_taggings_on_taggable_id_and_taggable_type ON taggings USING btree (taggable_id, taggable_type);
590
591
592--
593-- Name: index_tags_on_name; Type: INDEX; Schema: public; Owner: -; Tablespace:
594--
595
596CREATE UNIQUE INDEX index_tags_on_name ON tags USING btree (name);
597
598
599--
600-- Name: index_tasks_on_performed; Type: INDEX; Schema: public; Owner: -; Tablespace:
601--
602
603CREATE INDEX index_tasks_on_performed ON tasks USING btree (performed);
604
605
606--
607-- Name: index_users_on_email; Type: INDEX; Schema: public; Owner: -; Tablespace:
608--
609
610CREATE INDEX index_users_on_email ON users USING btree (email);
611
612
613--
614-- Name: index_users_on_login; Type: INDEX; Schema: public; Owner: -; Tablespace:
615--
616
617CREATE INDEX index_users_on_login ON users USING btree ("login");
618
619
620--
621-- Name: index_users_on_ssh_key_id; Type: INDEX; Schema: public; Owner: -; Tablespace:
622--
623
624CREATE INDEX index_users_on_ssh_key_id ON users USING btree (ssh_key_id);
625
626
627--
628-- PostgreSQL database dump complete
629--
630
631INSERT INTO schema_info (version) VALUES (19)
toggle raw diff