Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

[db] first pass on migration for the app #13

Merged
merged 1 commit into from

2 participants

@FotoVerite

No description provided.

@brixen brixen merged commit edb4c1c into rubyspec:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jan 4, 2013
  1. @FotoVerite
This page is out of date. Refresh to see the latest.
Showing with 282 additions and 0 deletions.
  1. +3 −0  app/models/comment.rb
  2. +4 −0 app/models/document.rb
  3. +7 −0 app/models/link.rb
  4. +6 −0 app/models/organization.rb
  5. +6 −0 app/models/paragraph.rb
  6. +4 −0 app/models/participant.rb
  7. +6 −0 app/models/proposal.rb
  8. +5 −0 app/models/section.rb
  9. +4 −0 app/models/sentence.rb
  10. +4 −0 app/models/vote.rb
  11. +8 −0 db/migrate/20130102195422_create_organizations.rb
  12. +11 −0 db/migrate/20130102195611_create_participants.rb
  13. +8 −0 db/migrate/20130102200302_create_proposals.rb
  14. +9 −0 db/migrate/20130102201343_create_votes.rb
  15. +9 −0 db/migrate/20130102202249_create_links.rb
  16. +9 −0 db/migrate/20130103041650_create_documents.rb
  17. +10 −0 db/migrate/20130103043801_create_sections.rb
  18. +10 −0 db/migrate/20130104174848_create_paragraphs.rb
  19. +9 −0 db/migrate/20130104175257_create_sentences.rb
  20. +10 −0 db/migrate/20130104175419_create_comments.rb
  21. +90 −0 db/schema.rb
  22. +5 −0 spec/models/comment_spec.rb
  23. +5 −0 spec/models/document_spec.rb
  24. +5 −0 spec/models/link_spec.rb
  25. +5 −0 spec/models/organization_spec.rb
  26. +5 −0 spec/models/paragraph_spec.rb
  27. +5 −0 spec/models/participant_spec.rb
  28. +5 −0 spec/models/proposal_spec.rb
  29. +5 −0 spec/models/section_spec.rb
  30. +5 −0 spec/models/sentence_spec.rb
  31. +5 −0 spec/models/vote_spec.rb
View
3  app/models/comment.rb
@@ -0,0 +1,3 @@
+class Comment < ActiveRecord::Base
+ belongs_to :commentable, :polymorphic => true
+end
View
4 app/models/document.rb
@@ -0,0 +1,4 @@
+class Document < ActiveRecord::Base
+ belongs_to :proposal
+ has_many :sections
+end
View
7 app/models/link.rb
@@ -0,0 +1,7 @@
+class Link < ActiveRecord::Base
+
+ belongs_to :proposal
+
+ KIND = [:documentation, :spec]
+
+end
View
6 app/models/organization.rb
@@ -0,0 +1,6 @@
+class Organization < ActiveRecord::Base
+
+ has_many :participants
+ has_many :proposals
+
+end
View
6 app/models/paragraph.rb
@@ -0,0 +1,6 @@
+class Paragraph < ActiveRecord::Base
+ belongs_to :section
+ has_many :sentences
+ has_many :comments, :as => :commentable
+
+end
View
4 app/models/participant.rb
@@ -0,0 +1,4 @@
+class Participant < ActiveRecord::Base
+ belongs_to :organization
+ has_many :votes
+end
View
6 app/models/proposal.rb
@@ -0,0 +1,6 @@
+class Proposal < ActiveRecord::Base
+ belongs_to :organization
+ has_one :document
+ has_many :votes
+ has_many :links
+end
View
5 app/models/section.rb
@@ -0,0 +1,5 @@
+class Section < ActiveRecord::Base
+ belongs_to :document
+ has_many :paragraphs
+ has_many :comments, :as => :commentable
+end
View
4 app/models/sentence.rb
@@ -0,0 +1,4 @@
+class Sentence < ActiveRecord::Base
+ belongs_to :paragraph
+ has_many :comments, :as => :commentable
+end
View
4 app/models/vote.rb
@@ -0,0 +1,4 @@
+class Vote < ActiveRecord::Base
+ belongs_to :proposal
+ belongs_to :participant
+end
View
8 db/migrate/20130102195422_create_organizations.rb
@@ -0,0 +1,8 @@
+class CreateOrganizations < ActiveRecord::Migration
+ def change
+ create_table :organizations do |t|
+ t.string :name
+ t.timestamps
+ end
+ end
+end
View
11 db/migrate/20130102195611_create_participants.rb
@@ -0,0 +1,11 @@
+class CreateParticipants < ActiveRecord::Migration
+ def change
+ create_table :participants do |t|
+ t.string :first_name
+ t.string :last_name
+ t.string :email
+ t.string :username #You'll thank me
+ t.timestamps
+ end
+ end
+end
View
8 db/migrate/20130102200302_create_proposals.rb
@@ -0,0 +1,8 @@
+class CreateProposals < ActiveRecord::Migration
+ def change
+ create_table :proposals do |t|
+ t.references :organization
+ t.timestamps
+ end
+ end
+end
View
9 db/migrate/20130102201343_create_votes.rb
@@ -0,0 +1,9 @@
+class CreateVotes < ActiveRecord::Migration
+ def change
+ create_table :votes do |t|
+ t.references :participant, :proposal
+ t.integer :value
+ t.timestamps
+ end
+ end
+end
View
9 db/migrate/20130102202249_create_links.rb
@@ -0,0 +1,9 @@
+class CreateLinks < ActiveRecord::Migration
+ def change
+ create_table :links do |t|
+ t.string :kind, :default => :documentation
+ t.string :url
+ t.timestamps
+ end
+ end
+end
View
9 db/migrate/20130103041650_create_documents.rb
@@ -0,0 +1,9 @@
+class CreateDocuments < ActiveRecord::Migration
+ def change
+ create_table :documents do |t|
+ t.text :abstract
+ t.text :summary
+ t.timestamps
+ end
+ end
+end
View
10 db/migrate/20130103043801_create_sections.rb
@@ -0,0 +1,10 @@
+class CreateSections < ActiveRecord::Migration
+ def change
+ create_table :sections do |t|
+ t.references :document
+ t.string :title
+ t.integer :position
+ t.timestamps
+ end
+ end
+end
View
10 db/migrate/20130104174848_create_paragraphs.rb
@@ -0,0 +1,10 @@
+class CreateParagraphs < ActiveRecord::Migration
+ def change
+ create_table :paragraphs do |t|
+ t.references :section
+ t.integer :position
+ t.string :kind
+ t.timestamps
+ end
+ end
+end
View
9 db/migrate/20130104175257_create_sentences.rb
@@ -0,0 +1,9 @@
+class CreateSentences < ActiveRecord::Migration
+ def change
+ create_table :sentences do |t|
+ t.references :paragraph
+ t.text :content
+ t.timestamps
+ end
+ end
+end
View
10 db/migrate/20130104175419_create_comments.rb
@@ -0,0 +1,10 @@
+class CreateComments < ActiveRecord::Migration
+ def change
+ create_table :comments do |t|
+ t.text :content
+ t.integer :commentable_id
+ t.string :commentable_type
+ t.timestamps
+ end
+ end
+end
View
90 db/schema.rb
@@ -0,0 +1,90 @@
+# 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 that you check this file into your version control system.
+
+ActiveRecord::Schema.define(version: 20130104175419) do
+
+ create_table "comments", force: true do |t|
+ t.text "content"
+ t.integer "commentable_id"
+ t.string "commentable_type"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "documents", force: true do |t|
+ t.text "abstract"
+ t.text "summary"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "links", force: true do |t|
+ t.string "kind", default: "documentation"
+ t.string "url"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "organizations", force: true do |t|
+ t.string "name"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "paragraphs", force: true do |t|
+ t.integer "section_id"
+ t.integer "position"
+ t.string "kind"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "participants", force: true do |t|
+ t.integer "organization_id"
+ t.string "first_name"
+ t.string "last_name"
+ t.string "email"
+ t.string "username"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "proposals", force: true do |t|
+ t.integer "organization_id"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "sections", force: true do |t|
+ t.integer "document_id"
+ t.string "title"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "sentences", force: true do |t|
+ t.integer "paragraph_id"
+ t.text "content"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ create_table "votes", force: true do |t|
+ t.integer "participant_id"
+ t.integer "proposal_id"
+ t.integer "value"
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+end
View
5 spec/models/comment_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe Comment do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
View
5 spec/models/document_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe Document do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
View
5 spec/models/link_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe Link do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
View
5 spec/models/organization_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe Organization do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
View
5 spec/models/paragraph_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe Paragraph do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
View
5 spec/models/participant_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe Participant do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
View
5 spec/models/proposal_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe Proposal do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
View
5 spec/models/section_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe Section do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
View
5 spec/models/sentence_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe Sentence do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
View
5 spec/models/vote_spec.rb
@@ -0,0 +1,5 @@
+require 'spec_helper'
+
+describe Vote do
+ pending "add some examples to (or delete) #{__FILE__}"
+end
Something went wrong with that request. Please try again.