kawara 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +21 -0
  3. data/app/controllers/kawara/articles_controller.rb +4 -0
  4. data/app/models/kawara/article.rb +5 -1
  5. data/app/models/kawara/article_image.rb +1 -0
  6. data/app/models/kawara/category.rb +4 -2
  7. data/app/models/kawara/meta_tag.rb +3 -2
  8. data/app/models/kawara/site.rb +17 -0
  9. data/app/models/kawara/tag.rb +5 -3
  10. data/app/views/kawara/articles/_list.html.erb +8 -1
  11. data/app/views/kawara/articles/index.html.erb +1 -0
  12. data/config/routes.rb +1 -1
  13. data/db/migrate/20160310220000_create_kawara_sites.rb +15 -0
  14. data/db/migrate/20160310230220_create_kawara_categories.rb +5 -4
  15. data/db/migrate/20160311072058_create_kawara_articles.rb +6 -6
  16. data/db/migrate/20160312220950_create_kawara_article_images.rb +5 -1
  17. data/db/migrate/20160315075716_create_kawara_tags.rb +4 -3
  18. data/db/migrate/20160316132735_create_kawara_meta_tags.rb +3 -2
  19. data/lib/kawara/version.rb +1 -1
  20. data/spec/controllers/kawara/articles_controller_spec.rb +23 -0
  21. data/spec/controllers/kawara/categories_controller_spec.rb +3 -2
  22. data/spec/controllers/kawara/tags_controller_spec.rb +3 -2
  23. data/spec/dummy/db/development.sqlite3 +0 -0
  24. data/spec/dummy/db/schema.rb +30 -13
  25. data/spec/dummy/db/test.sqlite3 +0 -0
  26. data/spec/dummy/log/development.log +3369 -0
  27. data/spec/dummy/log/test.log +25916 -0
  28. data/spec/dummy/tmp/uploads/store/00eadc27c6b661ade4f177913f0aef8227f78152a3dc2b2a06f3468f381e +1 -0
  29. data/spec/dummy/tmp/uploads/store/0a0678dce5685608002816d3e11c2245f25290c9f5b79e50d8f1cf8bfff9 +1 -0
  30. data/spec/dummy/tmp/uploads/store/0ba4ee6368599a35b621132fd395390657f4e9890e1db78356d8f2d2cedb +1 -0
  31. data/spec/dummy/tmp/uploads/store/1d67f0f2387377d0450eb96bc86fe0999b141f6c83c3e49916575b309897 +1 -0
  32. data/spec/dummy/tmp/uploads/store/2b5182bfd96902165f7de5840bf792ba1246bde1a3a2e6844f4158c31a00 +1 -0
  33. data/spec/dummy/tmp/uploads/store/307f9c5e8078c077ca60a6ff4f403903946d2370b06d769cffd1b2307cce +1 -0
  34. data/spec/dummy/tmp/uploads/store/37786fa41a824d3e01b7749c9cb726563176eb786b7a67ddffdec9dab2c1 +1 -0
  35. data/spec/dummy/tmp/uploads/store/41aef337889f76d874d7c806ec514fdf1739a18d9c90f3cb95300da7688c +1 -0
  36. data/spec/dummy/tmp/uploads/store/4502ce3259f3d7c11042df2b8f83dc0d0f4b085a980976c3a0ac5856b9d2 +1 -0
  37. data/spec/dummy/tmp/uploads/store/483cc47f8bc6f734629eac4b82895ab502c74f78e0008e1d0293d67453ce +1 -0
  38. data/spec/dummy/tmp/uploads/store/5f554b86f7d216820f6e4bee8c94239b96b3438d42e6921cd556a22472ce +1 -0
  39. data/spec/dummy/tmp/uploads/store/6c157157f62cbe02d8ef13b6a559e684b4e3e7f701a7b6f984d6c54855b8 +1 -0
  40. data/spec/dummy/tmp/uploads/store/6c965202ab644325d1f4c74c168824aa0ba0d5cbbbb6bbaeac70c5425431 +1 -0
  41. data/spec/dummy/tmp/uploads/store/7b129ca347bc353f71d0f60c356b87c42818dbce357d21e8c2e3745b5497 +1 -0
  42. data/spec/dummy/tmp/uploads/store/81a8cf6dfdd21766bad5c69b06f2e11163cf4e22dc4196c8057bb100be93 +1 -0
  43. data/spec/dummy/tmp/uploads/store/956906c8b726110b2b8dd5e59e8ef14bc323fbe7c7e9f686182e9876dcbf +1 -0
  44. data/spec/dummy/tmp/uploads/store/95bc5159ce4d8ebd76bfe38d9a2e37d59e241d01923a4529e0336c64ef8c +1 -0
  45. data/spec/dummy/tmp/uploads/store/abdf14dcb046cb845927776ff914152e385d15be4ad21803cbf92f7674e5 +1 -0
  46. data/spec/dummy/tmp/uploads/store/b45a4fb88af4363f9241765368e0facb088a012bd21075ba11c32597eb7b +1 -0
  47. data/spec/dummy/tmp/uploads/store/b67f6473f3887d3d2a6b1b60befe1297cd5eccbfae2dbd62559707f82bdf +1 -0
  48. data/spec/dummy/tmp/uploads/store/d34bf13b8e9121f2f448cbc2c8b3655587e384bbc35630f027bfc730766c +1 -0
  49. data/spec/dummy/tmp/uploads/store/d5112a56b31aba7b6b9929d01785648c150fd70463b795031094664bae74 +1 -0
  50. data/spec/dummy/tmp/uploads/store/ec0efb36de8853a429a576a8dbc3c1a73d3492a8d042532c873b65de5c22 +1 -0
  51. data/spec/dummy/tmp/uploads/store/edbd5f5bfb648d577561b6a0b56f189e4242c073dbb33e1b43fbd2027715 +1 -0
  52. data/spec/dummy/tmp/uploads/store/ee5baf280c4bada512096936e1d9792fc9252c51e189840ca01cebc9ea25 +1 -0
  53. data/spec/dummy/tmp/uploads/store/ee93a2d97cca1fd45fbcf08fd1df883f14a1abf7cc7e640c6514d8228e7f +1 -0
  54. data/spec/dummy/tmp/uploads/store/f4e5b7ed07ccdbdcbe0addad104ad6aefe500eda20bac737c70eb24ca5ba +1 -0
  55. data/spec/dummy/tmp/uploads/store/f81a41a99ef31080ae07c9af20818bed62acfc3497182f07a450a7422063 +1 -0
  56. data/spec/factories/kawara_article_images.rb +3 -2
  57. data/spec/factories/kawara_articles.rb +22 -10
  58. data/spec/factories/kawara_articles_meta_tags.rb +1 -1
  59. data/spec/factories/kawara_articles_tags.rb +1 -1
  60. data/spec/factories/kawara_categories.rb +4 -2
  61. data/spec/factories/kawara_meta_tags.rb +2 -1
  62. data/spec/factories/kawara_sites.rb +35 -0
  63. data/spec/factories/kawara_tags.rb +3 -2
  64. data/spec/models/kawara/article_image_spec.rb +3 -1
  65. data/spec/models/kawara/article_spec.rb +6 -6
  66. data/spec/models/kawara/articles_meta_tag_spec.rb +4 -2
  67. data/spec/models/kawara/articles_tag_spec.rb +4 -2
  68. data/spec/models/kawara/site_spec.rb +27 -0
  69. metadata +85 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9dd79233c86b1fb2004cf9a94a94dbfcaace57e3
4
- data.tar.gz: 791d8b14926050fe927d31ba8feb30892c9cea07
3
+ metadata.gz: 24d7db086d90e67f04b45ec5306c3ebe30ec5b9f
4
+ data.tar.gz: 1b791016be88b276766f866b092bcce2293225a5
5
5
  SHA512:
6
- metadata.gz: d3f0512b6b731b5131ee41bf275fc9af50699072da57a42348a24752ece221e16a1be8945ed1818674ad8b705b208f9ba2d2723c3275c33ea64a9eef107d2559
7
- data.tar.gz: de555d3b47a189bc31b5320ec3badce51f08d14c3d481a2b6ce866f4dad9c27c2e10b6d03c538fa02dce0456f753f2700b6d22895587c51f09aad724f153898a
6
+ metadata.gz: b33503687c5fd93080f9a580b52070e4d12a8fa1e1106a957c3380e4be2813feecc400f2200535b0cf56652cc5cef26a427d43adbc2a3d633bc11e7f3c8a00cc
7
+ data.tar.gz: 346dbfe0daac0ef9c1cfff3e2d3ce0c1ea0b1e6637cb95a111bce20025afecd102ebccb39dadd3b87941a93f04dda1dfeebf277e14fdbf9934a6145e9ac94738
data/README.md CHANGED
@@ -11,3 +11,24 @@ This project rocks and uses MIT-LICENSE.
11
11
 
12
12
  ## Categories are managed by Awesome Nested Set gem
13
13
 
14
+ # Getting Started
15
+
16
+ Add kawara gem to your Gemfile.
17
+
18
+ `gem kawara`
19
+
20
+ Install kawara gem.
21
+
22
+ `bundle install`
23
+
24
+ Copy migration files.
25
+
26
+ `bin/rake kawara:install:migrations`
27
+
28
+ Run migrations.
29
+
30
+ `bin/rake db:migrate`
31
+
32
+ Add route to kawara engine in your routes.rb.
33
+
34
+ `mount Kawara::Engine => '/blog'`
@@ -2,6 +2,10 @@ require_dependency "kawara/application_controller"
2
2
 
3
3
  module Kawara
4
4
  class ArticlesController < ApplicationController
5
+ def index
6
+ @articles = Article.latest
7
+ end
8
+
5
9
  def show
6
10
  @article = Kawara::Article.find_from_published(params[:id])
7
11
  end
@@ -4,8 +4,9 @@ module Kawara
4
4
  class Article < ActiveRecord::Base
5
5
 
6
6
  extend FriendlyId
7
- friendly_id :title, use: :slugged
7
+ friendly_id :title, use: :scoped, scope: :site
8
8
 
9
+ belongs_to :site
9
10
  belongs_to :category
10
11
  has_many :images, class_name: 'ArticleImage', dependent: :destroy
11
12
  has_many :articles_tags, dependent: :destroy
@@ -17,8 +18,11 @@ module Kawara
17
18
 
18
19
  accepts_attachments_for :images
19
20
 
21
+ delegate :name, to: :category, prefix: true
22
+
20
23
  scope :latest, -> (limit=10) { published.last(limit).reverse }
21
24
 
25
+
22
26
  def self.find_from_published(id)
23
27
  friendly.published.find(id)
24
28
  end
@@ -1,6 +1,7 @@
1
1
  module Kawara
2
2
  class ArticleImage < ActiveRecord::Base
3
3
 
4
+ belongs_to :site
4
5
  belongs_to :article
5
6
  attachment :file, type: :image
6
7
 
@@ -2,12 +2,14 @@ require 'awesome_nested_set'
2
2
 
3
3
  module Kawara
4
4
  class Category < ActiveRecord::Base
5
+
5
6
  extend FriendlyId
6
- friendly_id :name, use: :slugged
7
+ friendly_id :name, use: :scoped, scope: :site
7
8
 
8
9
  acts_as_nested_set
9
10
 
10
- has_many :articles
11
+ belongs_to :site
12
+ has_many :articles
11
13
 
12
14
  validates :name, presence: true
13
15
 
@@ -1,8 +1,9 @@
1
1
  module Kawara
2
2
  class MetaTag < ActiveRecord::Base
3
3
 
4
- has_many :articles_meta_tags, dependent: :destroy
5
- has_many :articles, through: :articles_meta_tags
4
+ belongs_to :site
5
+ has_many :articles_meta_tags, dependent: :destroy
6
+ has_many :articles, through: :articles_meta_tags
6
7
 
7
8
  validates :name, presence: true, uniqueness: true
8
9
  end
@@ -0,0 +1,17 @@
1
+ require 'subdomain_validation'
2
+
3
+ module Kawara
4
+ class Site < ActiveRecord::Base
5
+ include ::SubdomainValidation
6
+
7
+ has_many :categories, dependent: :destroy
8
+ has_many :articles, dependent: :destroy
9
+ has_many :tags, dependent: :destroy
10
+ has_many :article_images, dependent: :destroy
11
+ has_many :meta_tags, dependent: :destroy
12
+
13
+ enum status: { closed: 0, opened: 10 }
14
+
15
+ validates :name, subdomain: true, uniqueness: true
16
+ end
17
+ end
@@ -1,10 +1,12 @@
1
1
  module Kawara
2
2
  class Tag < ActiveRecord::Base
3
+
3
4
  extend FriendlyId
4
- friendly_id :name, use: :slugged
5
+ friendly_id :name, use: :scoped, scope: :site
5
6
 
6
- has_many :articles_tags, dependent: :destroy
7
- has_many :articles, through: :articles_tags
7
+ belongs_to :site
8
+ has_many :articles_tags, dependent: :destroy
9
+ has_many :articles, through: :articles_tags
8
10
 
9
11
  validates :name, presence: true, uniqueness: true
10
12
 
@@ -1,6 +1,13 @@
1
1
  <% articles.each do |article| %>
2
2
  <div>
3
- <h1><%= article.title %></h1>
3
+ <h1><%= link_to article.title, article %></h1>
4
4
  <p><%= article.subtitle %></p>
5
+ <p>Category: <%= link_to article.category_name, article.category %></p>
6
+ <p>
7
+ Tags:
8
+ <% article.tags.each do |tag| %>
9
+ <span><%= link_to tag.name, tag %></span>
10
+ <% end %>
11
+ </p>
5
12
  </div>
6
13
  <% end %>
@@ -0,0 +1 @@
1
+ <%= render 'kawara/articles/list', articles: @articles %>
data/config/routes.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  Kawara::Engine.routes.draw do
2
2
 
3
3
  resources :categories, only: %w(index show)
4
- resources :articles, only: %w(show)
4
+ resources :articles, only: %w(index show)
5
5
  resources :tags, only: %w(index show)
6
6
  root 'home#index'
7
7
  end
@@ -0,0 +1,15 @@
1
+ class CreateKawaraSites < ActiveRecord::Migration
2
+ def change
3
+ create_table :kawara_sites do |t|
4
+ t.string :name, null: false
5
+ t.string :title
6
+ t.string :description
7
+ t.integer :status, default: 0, null: false
8
+
9
+ t.timestamps null: false
10
+ end
11
+
12
+ add_index :kawara_sites, :name, unique: true
13
+ add_index :kawara_sites, :status
14
+ end
15
+ end
@@ -1,6 +1,7 @@
1
1
  class CreateKawaraCategories < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :kawara_categories do |t|
4
+ t.integer :site_id, null: false
4
5
  t.string :slug
5
6
  t.string :name, null: false
6
7
  t.integer :parent_id
@@ -12,9 +13,9 @@ class CreateKawaraCategories < ActiveRecord::Migration
12
13
  t.timestamps null: false
13
14
  end
14
15
 
15
- add_index :kawara_categories, :slug, unique: true
16
- add_index :kawara_categories, :parent_id
17
- add_index :kawara_categories, :lft
18
- add_index :kawara_categories, :rgt
16
+ add_index :kawara_categories, [:site_id, :slug], unique: true
17
+ add_index :kawara_categories, [:site_id, :parent_id]
18
+ add_index :kawara_categories, [:site_id, :lft]
19
+ add_index :kawara_categories, [:site_id, :rgt]
19
20
  end
20
21
  end
@@ -1,20 +1,20 @@
1
1
  class CreateKawaraArticles < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :kawara_articles do |t|
4
+ t.integer :site_id, null: false
4
5
  t.integer :category_id
5
6
  t.string :slug
6
7
  t.string :title
7
8
  t.string :subtitle
8
9
  t.text :content
9
- t.integer :status, default: 0, null: false
10
+ t.integer :status, default: 0, null: false
10
11
 
11
12
  t.timestamps null: false
12
13
  end
13
14
 
14
- add_index :kawara_articles, :slug, unique: true
15
- add_index :kawara_articles, [:status, :slug]
16
- add_index :kawara_articles, [:status, :id]
17
- add_index :kawara_articles, :category_id
18
- add_index :kawara_articles, [:category_id, :status]
15
+ add_index :kawara_articles, [:site_id, :slug], unique: true
16
+ add_index :kawara_articles, [:site_id, :status, :slug]
17
+ add_index :kawara_articles, [:site_id, :status, :id]
18
+ add_index :kawara_articles, [:site_id, :category_id, :status]
19
19
  end
20
20
  end
@@ -1,7 +1,8 @@
1
1
  class CreateKawaraArticleImages < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :kawara_article_images do |t|
4
- t.integer :article_id, null: false, index: true
4
+ t.integer :site_id, null: false
5
+ t.integer :article_id, null: false
5
6
  t.string :file_id, null: false
6
7
  t.string :file_filename
7
8
  t.integer :file_size
@@ -9,5 +10,8 @@ class CreateKawaraArticleImages < ActiveRecord::Migration
9
10
 
10
11
  t.timestamps null: false
11
12
  end
13
+
14
+ add_index :kawara_article_images, [:site_id, :article_id]
15
+ add_index :kawara_article_images, :file_id
12
16
  end
13
17
  end
@@ -1,14 +1,15 @@
1
1
  class CreateKawaraTags < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :kawara_tags do |t|
4
+ t.integer :site_id, null: false
4
5
  t.string :slug
5
- t.string :name, null: false
6
+ t.string :name, null: false
6
7
  t.integer :articles_count
7
8
 
8
9
  t.timestamps null: false
9
10
  end
10
11
 
11
- add_index :kawara_tags, :slug, unique: true
12
- add_index :kawara_tags, :name, unique: true
12
+ add_index :kawara_tags, [:site_id, :slug], unique: true
13
+ add_index :kawara_tags, [:site_id, :name], unique: true
13
14
  end
14
15
  end
@@ -1,12 +1,13 @@
1
1
  class CreateKawaraMetaTags < ActiveRecord::Migration
2
2
  def change
3
3
  create_table :kawara_meta_tags do |t|
4
- t.string :name, null: false
4
+ t.integer :site_id, null: false
5
+ t.string :name, null: false
5
6
  t.integer :articles_count
6
7
 
7
8
  t.timestamps null: false
8
9
  end
9
10
 
10
- add_index :kawara_meta_tags, :name, unique: true
11
+ add_index :kawara_meta_tags, [:site_id, :name], unique: true
11
12
  end
12
13
  end
@@ -1,3 +1,3 @@
1
1
  module Kawara
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -5,6 +5,29 @@ module Kawara
5
5
 
6
6
  routes { Kawara::Engine.routes }
7
7
 
8
+ describe 'GET #index' do
9
+ subject { get :index }
10
+
11
+ let(:draft_article) { create :draft_article }
12
+ let(:published_article) { create :published_article }
13
+
14
+ context 'when there is no published article' do
15
+ before { draft_article; subject }
16
+
17
+ it { expect(response).to render_template(:index) }
18
+ it { expect(response).to have_http_status(:success) }
19
+ it { expect(assigns(:articles)).to match_array(Kawara::Article.none) }
20
+ end
21
+
22
+ context 'when there is a published article' do
23
+ before { published_article; subject }
24
+
25
+ it { expect(response).to render_template(:index) }
26
+ it { expect(response).to have_http_status(:success) }
27
+ it { expect(assigns(:articles)).to match_array(published_article) }
28
+ end
29
+ end
30
+
8
31
  describe 'GET #show' do
9
32
  subject { get :show, id: id }
10
33
 
@@ -2,6 +2,7 @@ require 'rails_helper'
2
2
 
3
3
  module Kawara
4
4
  RSpec.describe CategoriesController, type: :controller do
5
+ let(:site) { create :opened_site_a }
5
6
 
6
7
  routes { Kawara::Engine.routes }
7
8
 
@@ -20,8 +21,8 @@ module Kawara
20
21
  describe 'GET #show' do
21
22
  subject { get :show, id: id }
22
23
 
23
- let(:category) { create :kawara_category }
24
- let(:category_with_published_articles) { create :kawara_category_with_published_articles }
24
+ let(:category) { create :kawara_category, site: site }
25
+ let(:category_with_published_articles) { create :kawara_category_with_published_articles, site: site }
25
26
 
26
27
  context 'when there are related articles' do
27
28
  let(:id) { category_with_published_articles.id }
@@ -2,6 +2,7 @@ require 'rails_helper'
2
2
 
3
3
  module Kawara
4
4
  RSpec.describe TagsController, type: :controller do
5
+ let(:site) { create :opened_site_a }
5
6
 
6
7
  routes { Kawara::Engine.routes }
7
8
 
@@ -21,8 +22,8 @@ module Kawara
21
22
  describe 'GET #show' do
22
23
  subject { get :show, id: id }
23
24
 
24
- let(:tag) { create :kawara_tag }
25
- let(:tag_with_published_articles) { create :kawara_tag_with_published_articles }
25
+ let(:tag) { create :kawara_tag, site: site }
26
+ let(:tag_with_published_articles) { create :kawara_tag_with_published_articles, site: site }
26
27
 
27
28
  context 'when there are related articles' do
28
29
  let(:id) { tag_with_published_articles.id }
Binary file
@@ -27,6 +27,7 @@ ActiveRecord::Schema.define(version: 20160324062743) do
27
27
  add_index "friendly_id_slugs", ["sluggable_type"], name: "index_friendly_id_slugs_on_sluggable_type"
28
28
 
29
29
  create_table "kawara_article_images", force: :cascade do |t|
30
+ t.integer "site_id", null: false
30
31
  t.integer "article_id", null: false
31
32
  t.string "file_id", null: false
32
33
  t.string "file_filename"
@@ -36,9 +37,11 @@ ActiveRecord::Schema.define(version: 20160324062743) do
36
37
  t.datetime "updated_at", null: false
37
38
  end
38
39
 
39
- add_index "kawara_article_images", ["article_id"], name: "index_kawara_article_images_on_article_id"
40
+ add_index "kawara_article_images", ["file_id"], name: "index_kawara_article_images_on_file_id"
41
+ add_index "kawara_article_images", ["site_id", "article_id"], name: "index_kawara_article_images_on_site_id_and_article_id"
40
42
 
41
43
  create_table "kawara_articles", force: :cascade do |t|
44
+ t.integer "site_id", null: false
42
45
  t.integer "category_id"
43
46
  t.string "slug"
44
47
  t.string "title"
@@ -49,11 +52,10 @@ ActiveRecord::Schema.define(version: 20160324062743) do
49
52
  t.datetime "updated_at", null: false
50
53
  end
51
54
 
52
- add_index "kawara_articles", ["category_id", "status"], name: "index_kawara_articles_on_category_id_and_status"
53
- add_index "kawara_articles", ["category_id"], name: "index_kawara_articles_on_category_id"
54
- add_index "kawara_articles", ["slug"], name: "index_kawara_articles_on_slug", unique: true
55
- add_index "kawara_articles", ["status", "id"], name: "index_kawara_articles_on_status_and_id"
56
- add_index "kawara_articles", ["status", "slug"], name: "index_kawara_articles_on_status_and_slug"
55
+ add_index "kawara_articles", ["site_id", "category_id", "status"], name: "index_kawara_articles_on_site_id_and_category_id_and_status"
56
+ add_index "kawara_articles", ["site_id", "slug"], name: "index_kawara_articles_on_site_id_and_slug", unique: true
57
+ add_index "kawara_articles", ["site_id", "status", "id"], name: "index_kawara_articles_on_site_id_and_status_and_id"
58
+ add_index "kawara_articles", ["site_id", "status", "slug"], name: "index_kawara_articles_on_site_id_and_status_and_slug"
57
59
 
58
60
  create_table "kawara_articles_meta_tags", force: :cascade do |t|
59
61
  t.integer "article_id", null: false
@@ -76,6 +78,7 @@ ActiveRecord::Schema.define(version: 20160324062743) do
76
78
  add_index "kawara_articles_tags", ["tag_id", "article_id"], name: "index_kawara_articles_tags_on_tag_id_and_article_id"
77
79
 
78
80
  create_table "kawara_categories", force: :cascade do |t|
81
+ t.integer "site_id", null: false
79
82
  t.string "slug"
80
83
  t.string "name", null: false
81
84
  t.integer "parent_id"
@@ -87,21 +90,35 @@ ActiveRecord::Schema.define(version: 20160324062743) do
87
90
  t.datetime "updated_at", null: false
88
91
  end
89
92
 
90
- add_index "kawara_categories", ["lft"], name: "index_kawara_categories_on_lft"
91
- add_index "kawara_categories", ["parent_id"], name: "index_kawara_categories_on_parent_id"
92
- add_index "kawara_categories", ["rgt"], name: "index_kawara_categories_on_rgt"
93
- add_index "kawara_categories", ["slug"], name: "index_kawara_categories_on_slug", unique: true
93
+ add_index "kawara_categories", ["site_id", "lft"], name: "index_kawara_categories_on_site_id_and_lft"
94
+ add_index "kawara_categories", ["site_id", "parent_id"], name: "index_kawara_categories_on_site_id_and_parent_id"
95
+ add_index "kawara_categories", ["site_id", "rgt"], name: "index_kawara_categories_on_site_id_and_rgt"
96
+ add_index "kawara_categories", ["site_id", "slug"], name: "index_kawara_categories_on_site_id_and_slug", unique: true
94
97
 
95
98
  create_table "kawara_meta_tags", force: :cascade do |t|
99
+ t.integer "site_id", null: false
96
100
  t.string "name", null: false
97
101
  t.integer "articles_count"
98
102
  t.datetime "created_at", null: false
99
103
  t.datetime "updated_at", null: false
100
104
  end
101
105
 
102
- add_index "kawara_meta_tags", ["name"], name: "index_kawara_meta_tags_on_name", unique: true
106
+ add_index "kawara_meta_tags", ["site_id", "name"], name: "index_kawara_meta_tags_on_site_id_and_name", unique: true
107
+
108
+ create_table "kawara_sites", force: :cascade do |t|
109
+ t.string "name", null: false
110
+ t.string "title"
111
+ t.string "description"
112
+ t.integer "status", default: 0, null: false
113
+ t.datetime "created_at", null: false
114
+ t.datetime "updated_at", null: false
115
+ end
116
+
117
+ add_index "kawara_sites", ["name"], name: "index_kawara_sites_on_name", unique: true
118
+ add_index "kawara_sites", ["status"], name: "index_kawara_sites_on_status"
103
119
 
104
120
  create_table "kawara_tags", force: :cascade do |t|
121
+ t.integer "site_id", null: false
105
122
  t.string "slug"
106
123
  t.string "name", null: false
107
124
  t.integer "articles_count"
@@ -109,7 +126,7 @@ ActiveRecord::Schema.define(version: 20160324062743) do
109
126
  t.datetime "updated_at", null: false
110
127
  end
111
128
 
112
- add_index "kawara_tags", ["name"], name: "index_kawara_tags_on_name", unique: true
113
- add_index "kawara_tags", ["slug"], name: "index_kawara_tags_on_slug", unique: true
129
+ add_index "kawara_tags", ["site_id", "name"], name: "index_kawara_tags_on_site_id_and_name", unique: true
130
+ add_index "kawara_tags", ["site_id", "slug"], name: "index_kawara_tags_on_site_id_and_slug", unique: true
114
131
 
115
132
  end
Binary file