Browse Source

Add Memo related models

pull/245/head
sylor_huang@126.com 5 years ago
parent
commit
7c290482aa
23 changed files with 193 additions and 0 deletions
  1. +2
    -0
      app/models/apply_forum.rb
  2. +2
    -0
      app/models/banned_forum.rb
  3. +2
    -0
      app/models/forum_moderator.rb
  4. +2
    -0
      app/models/forum_section.rb
  5. +2
    -0
      app/models/memo.rb
  6. +2
    -0
      app/models/memo_forum.rb
  7. +2
    -0
      app/models/section_notice.rb
  8. +2
    -0
      app/models/visit_action.rb
  9. +37
    -0
      db/migrate/20201012055111_create_memos.rb
  10. +13
    -0
      db/migrate/20201012055318_create_memo_forums.rb
  11. +22
    -0
      db/migrate/20201012055735_create_forum_sections.rb
  12. +13
    -0
      db/migrate/20201012060029_create_forum_moderators.rb
  13. +12
    -0
      db/migrate/20201012060303_create_section_notices.rb
  14. +16
    -0
      db/migrate/20201012060408_create_apply_forums.rb
  15. +15
    -0
      db/migrate/20201012060542_create_banned_forums.rb
  16. +14
    -0
      db/migrate/20201012060653_create_visit_actions.rb
  17. +5
    -0
      spec/models/apply_forum_spec.rb
  18. +5
    -0
      spec/models/banned_forum_spec.rb
  19. +5
    -0
      spec/models/forum_moderator_spec.rb
  20. +5
    -0
      spec/models/forum_section_spec.rb
  21. +5
    -0
      spec/models/memo_forum_spec.rb
  22. +5
    -0
      spec/models/section_notice_spec.rb
  23. +5
    -0
      spec/models/visit_action_spec.rb

+ 2
- 0
app/models/apply_forum.rb View File

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

+ 2
- 0
app/models/banned_forum.rb View File

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

+ 2
- 0
app/models/forum_moderator.rb View File

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

+ 2
- 0
app/models/forum_section.rb View File

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

+ 2
- 0
app/models/memo.rb View File

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

+ 2
- 0
app/models/memo_forum.rb View File

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

+ 2
- 0
app/models/section_notice.rb View File

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

+ 2
- 0
app/models/visit_action.rb View File

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

+ 37
- 0
db/migrate/20201012055111_create_memos.rb 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

+ 13
- 0
db/migrate/20201012055318_create_memo_forums.rb 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

+ 22
- 0
db/migrate/20201012055735_create_forum_sections.rb 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

+ 13
- 0
db/migrate/20201012060029_create_forum_moderators.rb 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

+ 12
- 0
db/migrate/20201012060303_create_section_notices.rb 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

+ 16
- 0
db/migrate/20201012060408_create_apply_forums.rb 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

+ 15
- 0
db/migrate/20201012060542_create_banned_forums.rb 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

+ 14
- 0
db/migrate/20201012060653_create_visit_actions.rb 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

+ 5
- 0
spec/models/apply_forum_spec.rb View File

@@ -0,0 +1,5 @@
require 'rails_helper'

RSpec.describe ApplyForum, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

+ 5
- 0
spec/models/banned_forum_spec.rb View File

@@ -0,0 +1,5 @@
require 'rails_helper'

RSpec.describe BannedForum, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

+ 5
- 0
spec/models/forum_moderator_spec.rb View File

@@ -0,0 +1,5 @@
require 'rails_helper'

RSpec.describe ForumModerator, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

+ 5
- 0
spec/models/forum_section_spec.rb View File

@@ -0,0 +1,5 @@
require 'rails_helper'

RSpec.describe ForumSection, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

+ 5
- 0
spec/models/memo_forum_spec.rb View File

@@ -0,0 +1,5 @@
require 'rails_helper'

RSpec.describe MemoForum, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

+ 5
- 0
spec/models/section_notice_spec.rb View File

@@ -0,0 +1,5 @@
require 'rails_helper'

RSpec.describe SectionNotice, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

+ 5
- 0
spec/models/visit_action_spec.rb View File

@@ -0,0 +1,5 @@
require 'rails_helper'

RSpec.describe VisitAction, type: :model do
pending "add some examples to (or delete) #{__FILE__}"
end

Loading…
Cancel
Save