表结构基本修改完成,后续表建立格式参照本次提交内容。
This commit is contained in:
parent
1862d28e9e
commit
b4f528efbd
|
@ -0,0 +1,39 @@
|
|||
about
|
||||
assets:clean[keep]
|
||||
assets:clobber
|
||||
assets:environment
|
||||
assets:precompile
|
||||
cache_digests:dependencies
|
||||
cache_digests:nested_dependencies
|
||||
db:create
|
||||
db:drop
|
||||
db:fixtures:load
|
||||
db:migrate
|
||||
db:migrate:status
|
||||
db:rollback
|
||||
db:schema:cache:clear
|
||||
db:schema:cache:dump
|
||||
db:schema:dump
|
||||
db:schema:load
|
||||
db:seed
|
||||
db:setup
|
||||
db:structure:dump
|
||||
db:structure:load
|
||||
db:version
|
||||
doc:app
|
||||
log:clear
|
||||
middleware
|
||||
notes
|
||||
notes:custom
|
||||
rails:template
|
||||
rails:update
|
||||
routes
|
||||
secret
|
||||
stats
|
||||
test
|
||||
test:all
|
||||
test:all:db
|
||||
test:db
|
||||
time:zones:all
|
||||
tmp:clear
|
||||
tmp:create
|
|
@ -0,0 +1,3 @@
|
|||
class Comment < ActiveRecord::Base
|
||||
belongs_to :mission
|
||||
end
|
|
@ -0,0 +1,4 @@
|
|||
class Mission < ActiveRecord::Base
|
||||
has_and_belongs_to_many :users
|
||||
has_many :comments
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
class Note < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
end
|
|
@ -0,0 +1,3 @@
|
|||
class Project < ActiveRecord::Base
|
||||
has_and_belongs_to_many :users
|
||||
end
|
|
@ -0,0 +1,2 @@
|
|||
class Share < ActiveRecord::Base
|
||||
end
|
|
@ -0,0 +1,6 @@
|
|||
class User < ActiveRecord::Base
|
||||
has_and_belongs_to_many :projects
|
||||
has_and_belongs_to_many :missions
|
||||
|
||||
has_many :notes
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class CreateUsers < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :users do |t|
|
||||
t.string :name
|
||||
t.string :password_digest
|
||||
t.string :email
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
class CreateProjects < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :projects do |t|
|
||||
t.string :name
|
||||
t.string :content
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,12 @@
|
|||
class CreateMissions < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :missions do |t|
|
||||
t.string :name
|
||||
t.datetime :deadline
|
||||
t.integer :priority
|
||||
t.string :status
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
class CreateComments < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :comments do |t|
|
||||
t.string :content
|
||||
t.references :mission, index: true, foreign_key: true
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
class CreateShares < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :shares do |t|
|
||||
t.string :content
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,10 @@
|
|||
class CreateNotes < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :notes do |t|
|
||||
t.string :content
|
||||
t.references :user, index: true, foreign_key: true
|
||||
|
||||
t.timestamps null: false
|
||||
end
|
||||
end
|
||||
end
|
|
@ -0,0 +1,11 @@
|
|||
class DropTablesNotNamedConventional < ActiveRecord::Migration
|
||||
def change
|
||||
drop_table :coment
|
||||
drop_table :mission
|
||||
drop_table :mission_coment
|
||||
drop_table :note
|
||||
drop_table :project
|
||||
drop_table :share
|
||||
drop_table :user
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class RenameMissionUserToMissionsUsers < ActiveRecord::Migration
|
||||
def change
|
||||
rename_table :mission_user, :missions_users
|
||||
end
|
||||
end
|
|
@ -0,0 +1,5 @@
|
|||
class RenameProjectUserToProjectsUsers < ActiveRecord::Migration
|
||||
def change
|
||||
rename_table :project_user, :projects_users
|
||||
end
|
||||
end
|
|
@ -0,0 +1,74 @@
|
|||
# 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: 20161210055513) do
|
||||
|
||||
create_table "comments", force: :cascade do |t|
|
||||
t.string "content"
|
||||
t.integer "mission_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_index "comments", ["mission_id"], name: "index_comments_on_mission_id"
|
||||
|
||||
create_table "missions", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.datetime "deadline"
|
||||
t.integer "priority"
|
||||
t.string "status"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "missions_users", id: false, force: :cascade do |t|
|
||||
t.integer "mission_id"
|
||||
t.integer "user_id"
|
||||
end
|
||||
|
||||
create_table "notes", force: :cascade do |t|
|
||||
t.string "content"
|
||||
t.integer "user_id"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
add_index "notes", ["user_id"], name: "index_notes_on_user_id"
|
||||
|
||||
create_table "projects", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "content"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "projects_users", id: false, force: :cascade do |t|
|
||||
t.integer "project_id"
|
||||
t.integer "user_id"
|
||||
end
|
||||
|
||||
create_table "shares", force: :cascade do |t|
|
||||
t.string "content"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
create_table "users", force: :cascade do |t|
|
||||
t.string "name"
|
||||
t.string "password_digest"
|
||||
t.string "email"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
end
|
||||
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
content: MyString
|
||||
mission_id:
|
||||
|
||||
two:
|
||||
content: MyString
|
||||
mission_id:
|
|
@ -0,0 +1,13 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
name: MyString
|
||||
deadline: 2016-12-10 12:48:43
|
||||
priority: 1
|
||||
status: MyString
|
||||
|
||||
two:
|
||||
name: MyString
|
||||
deadline: 2016-12-10 12:48:43
|
||||
priority: 1
|
||||
status: MyString
|
|
@ -0,0 +1,9 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
content:
|
||||
user_id:
|
||||
|
||||
two:
|
||||
content:
|
||||
user_id:
|
|
@ -0,0 +1,9 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
name: MyString
|
||||
content: MyString
|
||||
|
||||
two:
|
||||
name: MyString
|
||||
content: MyString
|
|
@ -0,0 +1,7 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
content: MyString
|
||||
|
||||
two:
|
||||
content: MyString
|
|
@ -0,0 +1,11 @@
|
|||
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
|
||||
|
||||
one:
|
||||
name: MyString
|
||||
password_digest: MyString
|
||||
email: MyString
|
||||
|
||||
two:
|
||||
name: MyString
|
||||
password_digest: MyString
|
||||
email: MyString
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class CommentTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class MissionTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class NoteTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class ProjectTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class ShareTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
|
@ -0,0 +1,7 @@
|
|||
require 'test_helper'
|
||||
|
||||
class UserTest < ActiveSupport::TestCase
|
||||
# test "the truth" do
|
||||
# assert true
|
||||
# end
|
||||
end
|
Loading…
Reference in New Issue