Add Memo related models

This commit is contained in:
sylor_huang@126.com 2020-10-12 14:19:33 +08:00
parent 75c951c204
commit 7c290482aa
23 changed files with 193 additions and 0 deletions

View File

@ -0,0 +1,2 @@
class ApplyForum < ApplicationRecord
end

View File

@ -0,0 +1,2 @@
class BannedForum < ApplicationRecord
end

View File

@ -0,0 +1,2 @@
class ForumModerator < ApplicationRecord
end

View File

@ -0,0 +1,2 @@
class ForumSection < ApplicationRecord
end

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

@ -0,0 +1,2 @@
class Memo < ApplicationRecord
end

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

@ -0,0 +1,2 @@
class MemoForum < ApplicationRecord
end

View File

@ -0,0 +1,2 @@
class SectionNotice < ApplicationRecord
end

View File

@ -0,0 +1,2 @@
class VisitAction < ApplicationRecord
end

View File

@ -0,0 +1,37 @@
class CreateMemos < ActiveRecord::Migration[5.2]
def change
create_table :memos do |t|
t.integer :forum_id, :null => false
t.integer :parent_id, null: true
t.string :subject, null: false
t.text :content, null: false
t.integer :author_id, null: false
t.integer :replies_count, default: 0
t.integer :last_reply_id
t.boolean :lock, default: false
t.boolean :sticky, default: false
t.integer :viewed_count, :default => 0
t.integer :root_id
t.integer :reward
t.string :language
t.boolean :hidden, :default => true
t.string :repertoire_name
t.boolean :is_md, :default => true
t.datetime :published_at
t.boolean :homepage_show, :default => false
t.integer :praises_count, :default => 0
t.boolean :is_fine, :default => false
t.datetime :last_reply_on
t.integer :tag_id, :default => 1
t.boolean :is_original
t.string :reprint_link
t.integer :forum_section_id
t.integer :destroy_status
t.timestamps
end
add_index :memos, :forum_id
add_index :memos, :author_id
add_index :memos, :forum_section_id
add_index :memos, :destroy_status
end
end

View File

@ -0,0 +1,13 @@
class CreateMemoForums < ActiveRecord::Migration[5.2]
def change
create_table :memo_forums do |t|
t.integer :memo_id
t.integer :forum_id
t.boolean :is_children, :default => false
t.timestamps
end
add_index :memo_forums, :memo_id
add_index :memo_forums, :forum_id
add_index :memo_forums, :is_children
end
end

View File

@ -0,0 +1,22 @@
class CreateForumSections < ActiveRecord::Migration[5.2]
def change
create_table :forum_sections do |t|
t.integer "user_id"
t.string "title"
t.integer "position", :default => 0
t.integer "parent_id"
t.integer "is_recommend", :default => 0
t.string "ancestry"
t.integer "attachment_id"
t.text "description"
t.integer "memos_count", :default => 0
t.integer "watchers_count", :default => 0
t.timestamps
end
add_index :forum_sections, :user_id
add_index :forum_sections, :title
add_index :forum_sections, :position
add_index :forum_sections, :ancestry
end
end

View File

@ -0,0 +1,13 @@
class CreateForumModerators < ActiveRecord::Migration[5.2]
def change
create_table :forum_moderators do |t|
t.integer "user_id"
t.integer "forum_section_id"
t.boolean "is_children", :default => false
t.timestamps
end
add_index :forum_moderators, :user_id
add_index :forum_moderators, :forum_section_id
add_index :forum_moderators, :is_children
end
end

View File

@ -0,0 +1,12 @@
class CreateSectionNotices < ActiveRecord::Migration[5.2]
def change
create_table :section_notices do |t|
t.integer "user_id"
t.integer "forum_section_id"
t.text "content"
t.timestamps
end
add_index :section_notices, :user_id
add_index :section_notices, :forum_section_id
end
end

View File

@ -0,0 +1,16 @@
class CreateApplyForums < ActiveRecord::Migration[5.2]
def change
create_table :apply_forums do |t|
t.integer "user_id"
t.string "user_ip"
t.integer "forum_section_id"
t.integer "is_confirm", :default => 0
t.integer "confirm_user_id"
t.datetime "deal_time"
t.timestamps
end
add_index :apply_forums, :user_id
add_index :apply_forums, :forum_section_id
add_index :apply_forums, :is_confirm
end
end

View File

@ -0,0 +1,15 @@
class CreateBannedForums < ActiveRecord::Migration[5.2]
def change
create_table :banned_forums do |t|
t.integer "user_id"
t.integer "author_id"
t.integer "memo_id"
t.integer "banned_count", :default => 0
t.boolean "is_banned", :default => false
t.timestamps
end
add_index :banned_forums, :user_id
add_index :banned_forums, :author_id
add_index :banned_forums, :memo_id
end
end

View File

@ -0,0 +1,14 @@
class CreateVisitActions < ActiveRecord::Migration[5.2]
def change
create_table :visit_actions do |t|
t.integer :visitable_id
t.string :visitable_type
t.integer :user_id
t.timestamps
end
add_index :visit_actions, :user_id
add_index :visit_actions, [:visitable_type, :visitable_id]
add_index :visit_actions,[:visitable_id,:user_id]
end
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe ApplyForum, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe BannedForum, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe ForumModerator, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe ForumSection, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe MemoForum, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe SectionNotice, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

View File

@ -0,0 +1,5 @@
require 'rails_helper'
RSpec.describe VisitAction, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end