数据库表

This commit is contained in:
tanhuazhe 2015-12-06 14:43:35 -06:00
parent 878425f9a8
commit 6fafc6a66f
29 changed files with 264 additions and 0 deletions

2
app/models/article.rb Normal file
View File

@ -0,0 +1,2 @@
class Article < ActiveRecord::Base
end

View File

@ -0,0 +1,2 @@
class ArticleComment < ActiveRecord::Base
end

View File

@ -0,0 +1,2 @@
class ArticleStar < ActiveRecord::Base
end

View File

@ -0,0 +1,2 @@
class ArticleView < ActiveRecord::Base
end

2
app/models/blog_info.rb Normal file
View File

@ -0,0 +1,2 @@
class BlogInfo < ActiveRecord::Base
end

2
app/models/category.rb Normal file
View File

@ -0,0 +1,2 @@
class Category < ActiveRecord::Base
end

2
app/models/user.rb Normal file
View File

@ -0,0 +1,2 @@
class User < ActiveRecord::Base
end

View File

@ -0,0 +1,16 @@
#encoding: utf-8
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :username
t.string :password_digest
t.string :email
t.boolean :admin
t.datetime :last_login_time
t.datetime :last_reply_time
t.timestamps
end
add_index :users, :username
add_index :users, :email
end
end

View File

@ -0,0 +1,8 @@
class CreateArticles < ActiveRecord::Migration
def change
create_table :articles do |t|
t.timestamps null: false
end
end
end

View File

@ -0,0 +1,8 @@
class CreateCategories < ActiveRecord::Migration
def change
create_table :categories do |t|
t.timestamps null: false
end
end
end

View File

@ -0,0 +1,8 @@
class CreateBlogInfos < ActiveRecord::Migration
def change
create_table :blog_infos do |t|
t.timestamps null: false
end
end
end

View File

@ -0,0 +1,8 @@
class CreateArticleStars < ActiveRecord::Migration
def change
create_table :article_stars do |t|
t.timestamps null: false
end
end
end

View File

@ -0,0 +1,8 @@
class CreateArticleViews < ActiveRecord::Migration
def change
create_table :article_views do |t|
t.timestamps null: false
end
end
end

View File

@ -0,0 +1,8 @@
class CreateArticleComments < ActiveRecord::Migration
def change
create_table :article_comments do |t|
t.timestamps null: false
end
end
end

60
db/schema.rb Normal file
View File

@ -0,0 +1,60 @@
# 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: 20151204094413) do
create_table "article_comments", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "article_stars", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "article_views", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "articles", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "blog_infos", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "categories", force: :cascade do |t|
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
end
create_table "users", force: :cascade do |t|
t.string "username"
t.string "password_digest"
t.string "email"
t.boolean "admin"
t.datetime "last_login_time"
t.datetime "last_reply_time"
t.datetime "created_at"
t.datetime "updated_at"
end
add_index "users", ["email"], name: "index_users_on_email"
add_index "users", ["username"], name: "index_users_on_username"
end

11
test/fixtures/article_comments.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value

11
test/fixtures/article_stars.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value

11
test/fixtures/article_views.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value

11
test/fixtures/articles.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value

11
test/fixtures/blog_infos.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value

11
test/fixtures/categories.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value

11
test/fixtures/users.yml vendored Normal file
View File

@ -0,0 +1,11 @@
# Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
# This model initially had no columns defined. If you add columns to the
# model remove the '{}' from the fixture names and add the columns immediately
# below each fixture, per the syntax in the comments below
#
one: {}
# column: value
#
two: {}
# column: value

View File

@ -0,0 +1,7 @@
require 'test_helper'
class ArticleCommentTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,7 @@
require 'test_helper'
class ArticleStarTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,7 @@
require 'test_helper'
class ArticleTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,7 @@
require 'test_helper'
class ArticleViewTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,7 @@
require 'test_helper'
class BlogInfoTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

View File

@ -0,0 +1,7 @@
require 'test_helper'
class CategoryTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end

7
test/models/user_test.rb Normal file
View File

@ -0,0 +1,7 @@
require 'test_helper'
class UserTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end