kawara 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +21 -0
- data/app/controllers/kawara/articles_controller.rb +4 -0
- data/app/models/kawara/article.rb +5 -1
- data/app/models/kawara/article_image.rb +1 -0
- data/app/models/kawara/category.rb +4 -2
- data/app/models/kawara/meta_tag.rb +3 -2
- data/app/models/kawara/site.rb +17 -0
- data/app/models/kawara/tag.rb +5 -3
- data/app/views/kawara/articles/_list.html.erb +8 -1
- data/app/views/kawara/articles/index.html.erb +1 -0
- data/config/routes.rb +1 -1
- data/db/migrate/20160310220000_create_kawara_sites.rb +15 -0
- data/db/migrate/20160310230220_create_kawara_categories.rb +5 -4
- data/db/migrate/20160311072058_create_kawara_articles.rb +6 -6
- data/db/migrate/20160312220950_create_kawara_article_images.rb +5 -1
- data/db/migrate/20160315075716_create_kawara_tags.rb +4 -3
- data/db/migrate/20160316132735_create_kawara_meta_tags.rb +3 -2
- data/lib/kawara/version.rb +1 -1
- data/spec/controllers/kawara/articles_controller_spec.rb +23 -0
- data/spec/controllers/kawara/categories_controller_spec.rb +3 -2
- data/spec/controllers/kawara/tags_controller_spec.rb +3 -2
- data/spec/dummy/db/development.sqlite3 +0 -0
- data/spec/dummy/db/schema.rb +30 -13
- data/spec/dummy/db/test.sqlite3 +0 -0
- data/spec/dummy/log/development.log +3369 -0
- data/spec/dummy/log/test.log +25916 -0
- data/spec/dummy/tmp/uploads/store/00eadc27c6b661ade4f177913f0aef8227f78152a3dc2b2a06f3468f381e +1 -0
- data/spec/dummy/tmp/uploads/store/0a0678dce5685608002816d3e11c2245f25290c9f5b79e50d8f1cf8bfff9 +1 -0
- data/spec/dummy/tmp/uploads/store/0ba4ee6368599a35b621132fd395390657f4e9890e1db78356d8f2d2cedb +1 -0
- data/spec/dummy/tmp/uploads/store/1d67f0f2387377d0450eb96bc86fe0999b141f6c83c3e49916575b309897 +1 -0
- data/spec/dummy/tmp/uploads/store/2b5182bfd96902165f7de5840bf792ba1246bde1a3a2e6844f4158c31a00 +1 -0
- data/spec/dummy/tmp/uploads/store/307f9c5e8078c077ca60a6ff4f403903946d2370b06d769cffd1b2307cce +1 -0
- data/spec/dummy/tmp/uploads/store/37786fa41a824d3e01b7749c9cb726563176eb786b7a67ddffdec9dab2c1 +1 -0
- data/spec/dummy/tmp/uploads/store/41aef337889f76d874d7c806ec514fdf1739a18d9c90f3cb95300da7688c +1 -0
- data/spec/dummy/tmp/uploads/store/4502ce3259f3d7c11042df2b8f83dc0d0f4b085a980976c3a0ac5856b9d2 +1 -0
- data/spec/dummy/tmp/uploads/store/483cc47f8bc6f734629eac4b82895ab502c74f78e0008e1d0293d67453ce +1 -0
- data/spec/dummy/tmp/uploads/store/5f554b86f7d216820f6e4bee8c94239b96b3438d42e6921cd556a22472ce +1 -0
- data/spec/dummy/tmp/uploads/store/6c157157f62cbe02d8ef13b6a559e684b4e3e7f701a7b6f984d6c54855b8 +1 -0
- data/spec/dummy/tmp/uploads/store/6c965202ab644325d1f4c74c168824aa0ba0d5cbbbb6bbaeac70c5425431 +1 -0
- data/spec/dummy/tmp/uploads/store/7b129ca347bc353f71d0f60c356b87c42818dbce357d21e8c2e3745b5497 +1 -0
- data/spec/dummy/tmp/uploads/store/81a8cf6dfdd21766bad5c69b06f2e11163cf4e22dc4196c8057bb100be93 +1 -0
- data/spec/dummy/tmp/uploads/store/956906c8b726110b2b8dd5e59e8ef14bc323fbe7c7e9f686182e9876dcbf +1 -0
- data/spec/dummy/tmp/uploads/store/95bc5159ce4d8ebd76bfe38d9a2e37d59e241d01923a4529e0336c64ef8c +1 -0
- data/spec/dummy/tmp/uploads/store/abdf14dcb046cb845927776ff914152e385d15be4ad21803cbf92f7674e5 +1 -0
- data/spec/dummy/tmp/uploads/store/b45a4fb88af4363f9241765368e0facb088a012bd21075ba11c32597eb7b +1 -0
- data/spec/dummy/tmp/uploads/store/b67f6473f3887d3d2a6b1b60befe1297cd5eccbfae2dbd62559707f82bdf +1 -0
- data/spec/dummy/tmp/uploads/store/d34bf13b8e9121f2f448cbc2c8b3655587e384bbc35630f027bfc730766c +1 -0
- data/spec/dummy/tmp/uploads/store/d5112a56b31aba7b6b9929d01785648c150fd70463b795031094664bae74 +1 -0
- data/spec/dummy/tmp/uploads/store/ec0efb36de8853a429a576a8dbc3c1a73d3492a8d042532c873b65de5c22 +1 -0
- data/spec/dummy/tmp/uploads/store/edbd5f5bfb648d577561b6a0b56f189e4242c073dbb33e1b43fbd2027715 +1 -0
- data/spec/dummy/tmp/uploads/store/ee5baf280c4bada512096936e1d9792fc9252c51e189840ca01cebc9ea25 +1 -0
- data/spec/dummy/tmp/uploads/store/ee93a2d97cca1fd45fbcf08fd1df883f14a1abf7cc7e640c6514d8228e7f +1 -0
- data/spec/dummy/tmp/uploads/store/f4e5b7ed07ccdbdcbe0addad104ad6aefe500eda20bac737c70eb24ca5ba +1 -0
- data/spec/dummy/tmp/uploads/store/f81a41a99ef31080ae07c9af20818bed62acfc3497182f07a450a7422063 +1 -0
- data/spec/factories/kawara_article_images.rb +3 -2
- data/spec/factories/kawara_articles.rb +22 -10
- data/spec/factories/kawara_articles_meta_tags.rb +1 -1
- data/spec/factories/kawara_articles_tags.rb +1 -1
- data/spec/factories/kawara_categories.rb +4 -2
- data/spec/factories/kawara_meta_tags.rb +2 -1
- data/spec/factories/kawara_sites.rb +35 -0
- data/spec/factories/kawara_tags.rb +3 -2
- data/spec/models/kawara/article_image_spec.rb +3 -1
- data/spec/models/kawara/article_spec.rb +6 -6
- data/spec/models/kawara/articles_meta_tag_spec.rb +4 -2
- data/spec/models/kawara/articles_tag_spec.rb +4 -2
- data/spec/models/kawara/site_spec.rb +27 -0
- metadata +85 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24d7db086d90e67f04b45ec5306c3ebe30ec5b9f
|
4
|
+
data.tar.gz: 1b791016be88b276766f866b092bcce2293225a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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'`
|
@@ -4,8 +4,9 @@ module Kawara
|
|
4
4
|
class Article < ActiveRecord::Base
|
5
5
|
|
6
6
|
extend FriendlyId
|
7
|
-
friendly_id :title, use: :
|
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
|
@@ -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: :
|
7
|
+
friendly_id :name, use: :scoped, scope: :site
|
7
8
|
|
8
9
|
acts_as_nested_set
|
9
10
|
|
10
|
-
|
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
|
-
|
5
|
-
has_many
|
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
|
data/app/models/kawara/tag.rb
CHANGED
@@ -1,10 +1,12 @@
|
|
1
1
|
module Kawara
|
2
2
|
class Tag < ActiveRecord::Base
|
3
|
+
|
3
4
|
extend FriendlyId
|
4
|
-
friendly_id :name, use: :
|
5
|
+
friendly_id :name, use: :scoped, scope: :site
|
5
6
|
|
6
|
-
|
7
|
-
has_many
|
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
@@ -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,
|
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 :
|
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,
|
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.
|
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
|
data/lib/kawara/version.rb
CHANGED
@@ -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
|
data/spec/dummy/db/schema.rb
CHANGED
@@ -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", ["
|
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: "
|
53
|
-
add_index "kawara_articles", ["
|
54
|
-
add_index "kawara_articles", ["
|
55
|
-
add_index "kawara_articles", ["status", "
|
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: "
|
91
|
-
add_index "kawara_categories", ["parent_id"], name: "
|
92
|
-
add_index "kawara_categories", ["rgt"], name: "
|
93
|
-
add_index "kawara_categories", ["slug"], name: "
|
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: "
|
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: "
|
113
|
-
add_index "kawara_tags", ["slug"], name: "
|
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
|
data/spec/dummy/db/test.sqlite3
CHANGED
Binary file
|