tb_blog 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -2
- data/app/assets/javascripts/admin/blog/posts.js +42 -0
- data/app/controllers/admin/post_categories_controller.rb +57 -57
- data/app/controllers/admin/posts_controller.rb +110 -101
- data/app/controllers/concerns/blog_url_helpers.rb +22 -18
- data/app/controllers/concerns/post_view_for_action.rb +11 -0
- data/app/controllers/posts_controller.rb +23 -34
- data/app/helpers/admin/posts_helper.rb +20 -20
- data/app/helpers/blog_helper.rb +21 -21
- data/app/models/spud/spud_post_model.rb +43 -51
- data/app/models/spud_blog_config.rb +2 -2
- data/app/models/spud_post.rb +1 -1
- data/app/models/spud_post_categories_post.rb +1 -1
- data/app/models/spud_post_category.rb +18 -20
- data/app/models/spud_post_site.rb +1 -1
- data/app/views/admin/posts/_form.html.erb +4 -3
- data/app/views/admin/posts/edit.html.erb +10 -2
- data/app/views/admin/posts/new.html.erb +9 -1
- data/app/views/admin/posts/show.html.erb +0 -0
- data/config/routes.rb +3 -1
- data/lib/generators/spud/blog/blog_generator.rb +5 -5
- data/lib/generators/spud/blog/random_posts_generator.rb +12 -14
- data/lib/generators/spud/blog/views_generator.rb +1 -1
- data/lib/spud_blog/configuration.rb +1 -2
- data/lib/spud_blog/engine.rb +12 -16
- data/lib/spud_blog/version.rb +3 -3
- data/lib/tasks/spud_blog_tasks.rake +1 -1
- data/lib/tb_blog.rb +2 -2
- data/spec/controllers/admin/posts_controller_spec.rb +28 -7
- data/spec/controllers/posts_controller_spec.rb +7 -7
- data/spec/dummy/config/application.rb +2 -3
- data/spec/dummy/config/boot.rb +1 -1
- data/spec/dummy/config/environment.rb +2 -2
- data/spec/dummy/config/environments/test.rb +3 -3
- data/spec/dummy/config/routes.rb +1 -1
- data/spec/dummy/config.ru +1 -1
- data/spec/dummy/db/migrate/{20120610130206_create_spud_admin_permissions.spud_core.rb → 20161020155425_create_spud_admin_permissions.tb_core.rb} +1 -1
- data/spec/dummy/db/migrate/20161020155426_create_spud_users.tb_core.rb +30 -0
- data/spec/dummy/db/migrate/{20120610130208_add_time_zone_to_spud_user.spud_core.rb → 20161020155427_add_time_zone_to_spud_user.tb_core.rb} +1 -2
- data/spec/dummy/db/migrate/{20120610130209_add_scope_to_spud_admin_permissions.spud_core.rb → 20161020155428_add_scope_to_spud_admin_permissions.tb_core.rb} +1 -2
- data/spec/dummy/db/migrate/{20120610130210_create_spud_user_settings.spud_core.rb → 20161020155429_create_spud_user_settings.tb_core.rb} +1 -1
- data/spec/dummy/db/migrate/{20140110180411_create_spud_roles.tb_core.rb → 20161020155430_create_spud_roles.tb_core.rb} +0 -0
- data/spec/dummy/db/migrate/{20140110180412_create_spud_permissions.tb_core.rb → 20161020155431_create_spud_permissions.tb_core.rb} +3 -3
- data/spec/dummy/db/migrate/{20140110180413_create_spud_role_permissions.tb_core.rb → 20161020155432_create_spud_role_permissions.tb_core.rb} +2 -2
- data/spec/dummy/db/migrate/{20140110180414_drop_spud_admin_permissions.tb_core.rb → 20161020155433_drop_spud_admin_permissions.tb_core.rb} +0 -0
- data/spec/dummy/db/migrate/{20160215174632_add_requires_password_change_to_spud_users.tb_core.rb → 20161020155434_add_requires_password_change_to_spud_users.tb_core.rb} +1 -1
- data/spec/dummy/db/migrate/{20160215174633_create_tb_redirects.tb_redirects.rb → 20161020155435_create_tb_redirects.tb_redirects.rb} +3 -3
- data/spec/dummy/db/migrate/{20140113162805_create_tb_liquid_spud_liquid_tags.tb_liquid.rb → 20161020155436_create_tb_liquid_spud_liquid_tags.tb_liquid.rb} +0 -0
- data/spec/dummy/db/migrate/{20140110180418_create_spud_posts.tb_blog.rb → 20161020155437_create_spud_posts.tb_blog.rb} +3 -3
- data/spec/dummy/db/migrate/{20140110180419_create_spud_post_categories.tb_blog.rb → 20161020155438_create_spud_post_categories.tb_blog.rb} +4 -4
- data/spec/dummy/db/migrate/{20140110180421_add_url_to_spud_posts.tb_blog.rb → 20161020155439_add_url_to_spud_posts.tb_blog.rb} +2 -2
- data/spec/dummy/db/migrate/20161020155440_add_url_to_spud_post_categories.tb_blog.rb +9 -0
- data/spec/dummy/db/migrate/{20140110180423_add_is_news_to_spud_posts.tb_blog.rb → 20161020155441_add_is_news_to_spud_posts.tb_blog.rb} +2 -2
- data/spec/dummy/db/migrate/{20140110180424_add_meta_to_posts.tb_blog.rb → 20161020155442_add_meta_to_posts.tb_blog.rb} +0 -0
- data/spec/dummy/db/migrate/{20140110180426_create_spud_post_sites.tb_blog.rb → 20161020155443_create_spud_post_sites.tb_blog.rb} +3 -3
- data/spec/dummy/db/migrate/{20140110180429_add_nested_set_to_post_categories.tb_blog.rb → 20161020155444_add_nested_set_to_post_categories.tb_blog.rb} +1 -5
- data/spec/dummy/db/migrate/{20140110180430_add_content_format_to_spud_posts.tb_blog.rb → 20161020155445_add_content_format_to_spud_posts.tb_blog.rb} +1 -1
- data/spec/dummy/db/migrate/{20140110180431_add_content_processed_to_spud_post.tb_blog.rb → 20161020155446_add_content_processed_to_spud_post.tb_blog.rb} +0 -0
- data/spec/dummy/db/migrate/{20140730131549_add_primary_key_to_spud_post_categories_posts.tb_blog.rb → 20161020155447_add_primary_key_to_spud_post_categories_posts.tb_blog.rb} +0 -0
- data/spec/dummy/db/migrate/{20140730131550_remove_awesome_nested_set_columns_from_spud_post_categories.tb_blog.rb → 20161020155448_remove_awesome_nested_set_columns_from_spud_post_categories.tb_blog.rb} +2 -1
- data/spec/dummy/db/migrate/{20140811161502_add_blog_key_to_spud_posts.tb_blog.rb → 20161020155449_add_blog_key_to_spud_posts.tb_blog.rb} +0 -0
- data/spec/dummy/db/migrate/{20150116195007_drop_spud_post_sites.tb_blog.rb → 20161020155450_drop_spud_post_sites.tb_blog.rb} +4 -3
- data/spec/dummy/db/migrate/{20151015154040_add_custom_author_to_post.tb_blog.rb → 20161020155451_add_custom_author_to_post.tb_blog.rb} +1 -1
- data/spec/dummy/db/migrate/{20160216150847_add_identifier_to_spud_posts.tb_blog.rb → 20161020155452_add_identifier_to_spud_posts.tb_blog.rb} +1 -1
- data/spec/dummy/db/schema.rb +106 -118
- data/spec/dummy/script/rails +2 -2
- data/spec/factories/spud_post_factories.rb +2 -2
- data/spec/helpers/admin/posts_helper_spec.rb +1 -1
- data/spec/models/spud_post_spec.rb +4 -4
- data/spec/rails_helper.rb +5 -5
- data/spec/spec_helper.rb +42 -44
- metadata +77 -79
- data/spec/dummy/db/migrate/20120610130207_create_spud_users.spud_core.rb +0 -30
- data/spec/dummy/db/migrate/20140110180415_create_spud_permalinks.tb_permalinks.rb +0 -12
- data/spec/dummy/db/migrate/20140110180416_add_site_id_to_spud_permalinks.tb_permalinks.rb +0 -7
- data/spec/dummy/db/migrate/20140110180417_modify_site_id_for_spud_permalinks.tb_permalinks.rb +0 -12
- data/spec/dummy/db/migrate/20140110180420_create_spud_post_comments.tb_blog.rb +0 -14
- data/spec/dummy/db/migrate/20140110180422_add_url_to_spud_post_categories.tb_blog.rb +0 -9
- data/spec/dummy/db/migrate/20140110180425_add_comments_counter_to_spud_posts.tb_blog.rb +0 -13
- data/spec/dummy/db/migrate/20140110180427_add_spam_fields_to_spud_post_comments.tb_blog.rb +0 -9
- data/spec/dummy/db/migrate/20140110180428_add_permalink_to_spud_post_comments.tb_blog.rb +0 -6
- data/spec/dummy/db/migrate/20140811161503_add_blog_key_to_spud_post_comments.tb_blog.rb +0 -7
- data/spec/dummy/db/migrate/20160216153113_drop_spud_post_comments.rb +0 -29
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
describe Admin::PostsController, :
|
3
|
+
describe Admin::PostsController, type: :controller do
|
4
4
|
|
5
5
|
before(:each) do
|
6
6
|
activate_session(admin: true)
|
@@ -12,16 +12,37 @@ describe Admin::PostsController, :type => :controller do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
it 'should create a redirect' do
|
15
|
-
expect
|
16
|
-
put :update, :
|
17
|
-
|
15
|
+
expect do
|
16
|
+
put :update, id: @post.id, spud_post: { url_name: 'new-url' }, blog_key: 'blog'
|
17
|
+
end.to change(@post.tb_redirects, :count).by(1)
|
18
18
|
end
|
19
19
|
|
20
20
|
it 'should not create a redirect' do
|
21
|
-
expect
|
22
|
-
put :update, :
|
23
|
-
|
21
|
+
expect do
|
22
|
+
put :update, id: @post.id, spud_post: { title: 'Hello World' }, blog_key: 'blog'
|
23
|
+
end.to_not change(@post.tb_redirects, :count)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
describe '#preview' do
|
28
|
+
context 'with a new post' do
|
29
|
+
it 'should set the attributes without saving' do
|
30
|
+
expect do
|
31
|
+
post :preview, blog_key: 'blog', post_id: nil, spud_post: { title: 'Hello World' }
|
32
|
+
end.to_not change(SpudPost, :count)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
context 'with an existing post' do
|
36
|
+
it 'should set the attributes without saving' do
|
37
|
+
@post = FactoryGirl.create(:spud_post)
|
38
|
+
expect do
|
39
|
+
post :preview,
|
40
|
+
blog_key: @post.blog_key,
|
41
|
+
post_id: @post.id,
|
42
|
+
spud_post: { title: 'Hello World' }
|
43
|
+
@post.reload
|
44
|
+
end.to_not change(@post, :title)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
27
48
|
end
|
@@ -1,27 +1,27 @@
|
|
1
1
|
require 'rails_helper'
|
2
2
|
|
3
|
-
describe PostsController, :
|
3
|
+
describe PostsController, type: :controller do
|
4
4
|
|
5
5
|
before(:each) do
|
6
6
|
activate_authlogic
|
7
7
|
end
|
8
8
|
|
9
9
|
describe 'index' do
|
10
|
-
it
|
11
|
-
2.times { |
|
12
|
-
get :index,
|
10
|
+
it 'should display a list of posts' do
|
11
|
+
2.times { |_i| FactoryGirl.create(:spud_post) }
|
12
|
+
get :index, blog_key: 'blog'
|
13
13
|
expect(assigns(:posts).count).to be > 1
|
14
14
|
end
|
15
15
|
|
16
|
-
it
|
17
|
-
Spud::Blog.config.query_for_user = ->(user){
|
16
|
+
it 'should not display any posts' do
|
17
|
+
Spud::Blog.config.query_for_user = ->(user) {
|
18
18
|
if user.blank?
|
19
19
|
'1=0'
|
20
20
|
else
|
21
21
|
{}
|
22
22
|
end
|
23
23
|
}
|
24
|
-
get :index,
|
24
|
+
get :index, blog_key: 'blog'
|
25
25
|
expect(assigns(:posts).count).to be 0
|
26
26
|
Spud::Blog.config.query_for_user = nil
|
27
27
|
end
|
@@ -3,7 +3,7 @@ require File.expand_path('../boot', __FILE__)
|
|
3
3
|
require 'rails/all'
|
4
4
|
|
5
5
|
Bundler.require
|
6
|
-
require
|
6
|
+
require 'tb_blog'
|
7
7
|
|
8
8
|
module Dummy
|
9
9
|
class Application < Rails::Application
|
@@ -36,7 +36,7 @@ module Dummy
|
|
36
36
|
config.i18n.enforce_available_locales = true
|
37
37
|
|
38
38
|
# Configure the default encoding used in templates for Ruby 1.9.
|
39
|
-
config.encoding =
|
39
|
+
config.encoding = 'utf-8'
|
40
40
|
|
41
41
|
# Configure sensitive parameters which will be filtered from the log file.
|
42
42
|
config.filter_parameters += [:password]
|
@@ -64,4 +64,3 @@ module Dummy
|
|
64
64
|
config.assets.version = '1.0'
|
65
65
|
end
|
66
66
|
end
|
67
|
-
|
data/spec/dummy/config/boot.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
require File.expand_path('../application', __FILE__)
|
3
3
|
|
4
4
|
Spud::Blog.configure do |config|
|
5
|
-
|
6
|
-
|
5
|
+
config.news_enabled = true
|
6
|
+
config.news_layout = 'application'
|
7
7
|
end
|
8
8
|
|
9
9
|
# Initialize the rails application
|
@@ -1,4 +1,4 @@
|
|
1
|
-
Dummy::Application.configure do
|
1
|
+
Dummy::Application.configure do
|
2
2
|
# Settings specified here will take precedence over those in config/application.rb
|
3
3
|
|
4
4
|
# The test environment is used exclusively to run your application's
|
@@ -9,7 +9,7 @@ Dummy::Application.configure do
|
|
9
9
|
|
10
10
|
# Configure static asset server for tests with Cache-Control for performance
|
11
11
|
config.serve_static_assets = true
|
12
|
-
config.static_cache_control =
|
12
|
+
config.static_cache_control = 'public, max-age=3600'
|
13
13
|
|
14
14
|
# Do not eager load code on boot. This avoids loading your whole application
|
15
15
|
# just for the purpose of running a single test. If you are using a tool that
|
@@ -24,7 +24,7 @@ Dummy::Application.configure do
|
|
24
24
|
config.action_dispatch.show_exceptions = false
|
25
25
|
|
26
26
|
# Disable request forgery protection in test environment
|
27
|
-
config.action_controller.allow_forgery_protection
|
27
|
+
config.action_controller.allow_forgery_protection = false
|
28
28
|
|
29
29
|
# Tell Action Mailer not to deliver emails to the real world.
|
30
30
|
# The :test delivery method accumulates sent emails in the
|
data/spec/dummy/config/routes.rb
CHANGED
data/spec/dummy/config.ru
CHANGED
@@ -0,0 +1,30 @@
|
|
1
|
+
# This migration comes from tb_core (originally 20111214161146)
|
2
|
+
class CreateSpudUsers < ActiveRecord::Migration
|
3
|
+
def change
|
4
|
+
create_table :spud_users do |t|
|
5
|
+
|
6
|
+
t.string :first_name
|
7
|
+
t.string :last_name
|
8
|
+
t.boolean :super_admin
|
9
|
+
t.string :login, null: false # optional, you can use email instead, or both
|
10
|
+
t.string :email, null: false # optional, you can use login instead, or both
|
11
|
+
t.string :crypted_password, null: false # optional, see below
|
12
|
+
t.string :password_salt, null: false # optional, but highly recommended
|
13
|
+
t.string :persistence_token, null: false # required
|
14
|
+
t.string :single_access_token, null: false # optional, see Authlogic::Session::Params
|
15
|
+
t.string :perishable_token, null: false # optional, see Authlogic::Session::Perishability
|
16
|
+
|
17
|
+
# Magic columns, just like ActiveRecord's created_at and updated_at. These are automatically maintained by Authlogic if they are present.
|
18
|
+
t.integer :login_count, null: false, default: 0 # optional, see Authlogic::Session::MagicColumns
|
19
|
+
t.integer :failed_login_count, null: false, default: 0 # optional, see Authlogic::Session::MagicColumns
|
20
|
+
t.datetime :last_request_at # optional, see Authlogic::Session::MagicColumns
|
21
|
+
t.datetime :current_login_at # optional, see Authlogic::Session::MagicColumns
|
22
|
+
t.datetime :last_login_at # optional, see Authlogic::Session::MagicColumns
|
23
|
+
t.string :current_login_ip # optional, see Authlogic::Session::MagicColumns
|
24
|
+
t.string :last_login_ip # optional, see Authlogic::Session::MagicColumns
|
25
|
+
t.timestamps
|
26
|
+
end
|
27
|
+
add_index :spud_users, :login
|
28
|
+
add_index :spud_users, :email
|
29
|
+
end
|
30
|
+
end
|
@@ -1,7 +1,6 @@
|
|
1
|
-
# This migration comes from
|
1
|
+
# This migration comes from tb_core (originally 20120328235431)
|
2
2
|
class AddScopeToSpudAdminPermissions < ActiveRecord::Migration
|
3
3
|
def change
|
4
4
|
add_column :spud_admin_permissions, :scope, :string
|
5
|
-
|
6
5
|
end
|
7
6
|
end
|
File without changes
|
@@ -2,10 +2,10 @@
|
|
2
2
|
class CreateSpudPermissions < ActiveRecord::Migration
|
3
3
|
def change
|
4
4
|
create_table :spud_permissions do |t|
|
5
|
-
t.string :name, :
|
6
|
-
t.string :tag, :
|
5
|
+
t.string :name, null: false
|
6
|
+
t.string :tag, null: false
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
|
-
add_index :spud_permissions, :tag, :
|
9
|
+
add_index :spud_permissions, :tag, unique: true
|
10
10
|
end
|
11
11
|
end
|
@@ -2,8 +2,8 @@
|
|
2
2
|
class CreateSpudRolePermissions < ActiveRecord::Migration
|
3
3
|
def change
|
4
4
|
create_table :spud_role_permissions do |t|
|
5
|
-
t.integer :spud_role_id, :
|
6
|
-
t.string :spud_permission_tag, :
|
5
|
+
t.integer :spud_role_id, null: false
|
6
|
+
t.string :spud_permission_tag, null: false
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
9
|
add_index :spud_role_permissions, :spud_role_id
|
File without changes
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# This migration comes from tb_core (originally 20150610143438)
|
2
2
|
class AddRequiresPasswordChangeToSpudUsers < ActiveRecord::Migration
|
3
3
|
def change
|
4
|
-
add_column :spud_users, :requires_password_change, :boolean, :
|
4
|
+
add_column :spud_users, :requires_password_change, :boolean, default: false
|
5
5
|
end
|
6
6
|
end
|
@@ -4,12 +4,12 @@ class CreateTbRedirects < ActiveRecord::Migration
|
|
4
4
|
create_table :tb_redirects do |t|
|
5
5
|
t.string :owner_type
|
6
6
|
t.integer :owner_id
|
7
|
-
t.string :source, :
|
8
|
-
t.string :destination, :
|
7
|
+
t.string :source, null: false
|
8
|
+
t.string :destination, null: false
|
9
9
|
t.string :created_by
|
10
10
|
t.timestamps null: false
|
11
11
|
end
|
12
12
|
add_index :tb_redirects, [:owner_type, :owner_id]
|
13
|
-
add_index :tb_redirects, :source, :
|
13
|
+
add_index :tb_redirects, :source, unique: true
|
14
14
|
end
|
15
15
|
end
|
File without changes
|
@@ -5,12 +5,12 @@ class CreateSpudPosts < ActiveRecord::Migration
|
|
5
5
|
t.integer :spud_user_id
|
6
6
|
t.string :title
|
7
7
|
t.text :content
|
8
|
-
t.boolean :comments_enabled, :
|
9
|
-
t.boolean :visible, :
|
8
|
+
t.boolean :comments_enabled, default: false
|
9
|
+
t.boolean :visible, default: true
|
10
10
|
t.datetime :published_at
|
11
11
|
t.timestamps
|
12
12
|
end
|
13
13
|
add_index :spud_posts, :spud_user_id
|
14
14
|
add_index :spud_posts, :visible
|
15
15
|
end
|
16
|
-
end
|
16
|
+
end
|
@@ -5,10 +5,10 @@ class CreateSpudPostCategories < ActiveRecord::Migration
|
|
5
5
|
t.string :name
|
6
6
|
t.timestamps
|
7
7
|
end
|
8
|
-
create_table :spud_post_categories_posts, :
|
9
|
-
|
10
|
-
|
8
|
+
create_table :spud_post_categories_posts, id: false do |t|
|
9
|
+
t.integer :spud_post_id
|
10
|
+
t.integer :spud_post_category_id
|
11
11
|
end
|
12
12
|
add_index :spud_post_categories_posts, :spud_post_category_id
|
13
13
|
end
|
14
|
-
end
|
14
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# This migration comes from tb_blog (originally 20120127143054)
|
2
2
|
class AddUrlToSpudPosts < ActiveRecord::Migration
|
3
3
|
def change
|
4
|
-
|
5
|
-
|
4
|
+
add_column :spud_posts, :url_name, :string
|
5
|
+
add_index :spud_posts, :url_name
|
6
6
|
end
|
7
7
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# This migration comes from tb_blog (originally 20120127144942)
|
2
|
+
class AddUrlToSpudPostCategories < ActiveRecord::Migration
|
3
|
+
def change
|
4
|
+
add_column :spud_post_categories, :parent_id, :integer, default: 0
|
5
|
+
add_column :spud_post_categories, :url_name, :string
|
6
|
+
add_index :spud_post_categories, :parent_id
|
7
|
+
add_index :spud_post_categories, :url_name
|
8
|
+
end
|
9
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# This migration comes from tb_blog (originally 20120210165540)
|
2
2
|
class AddIsNewsToSpudPosts < ActiveRecord::Migration
|
3
3
|
def change
|
4
|
-
|
5
|
-
|
4
|
+
add_column :spud_posts, :is_news, :boolean, default: false
|
5
|
+
add_index :spud_posts, :is_news
|
6
6
|
end
|
7
7
|
end
|
File without changes
|
@@ -2,11 +2,11 @@
|
|
2
2
|
class CreateSpudPostSites < ActiveRecord::Migration
|
3
3
|
def change
|
4
4
|
create_table :spud_post_sites do |t|
|
5
|
-
t.integer :spud_post_id, :
|
6
|
-
t.integer :spud_site_id, :
|
5
|
+
t.integer :spud_post_id, null: false
|
6
|
+
t.integer :spud_site_id, null: false
|
7
7
|
t.timestamps
|
8
8
|
end
|
9
9
|
add_index :spud_post_sites, :spud_post_id
|
10
|
-
add_index :spud_post_sites, :spud_site_id
|
10
|
+
add_index :spud_post_sites, :spud_site_id
|
11
11
|
end
|
12
12
|
end
|
@@ -6,15 +6,11 @@ class AddNestedSetToPostCategories < ActiveRecord::Migration
|
|
6
6
|
t.integer :rgt
|
7
7
|
t.integer :depth
|
8
8
|
end
|
9
|
-
|
10
|
-
# Populates lft, rgt, and depth values for nested set
|
11
|
-
#SpudPostCategory.where(:parent_id => 0).update_all({:parent_id => nil})
|
12
|
-
#SpudPostCategory.rebuild!
|
13
9
|
end
|
14
10
|
|
15
11
|
def down
|
16
12
|
change_table :spud_post_categories do |t|
|
17
|
-
t.remove :
|
13
|
+
t.remove :lft
|
18
14
|
t.remove :rgt
|
19
15
|
t.remove :depth
|
20
16
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# This migration comes from tb_blog (originally 20130120151857)
|
2
2
|
class AddContentFormatToSpudPosts < ActiveRecord::Migration
|
3
3
|
def change
|
4
|
-
add_column :spud_posts, :content_format, :string, :
|
4
|
+
add_column :spud_posts, :content_format, :string, default: 'HTML'
|
5
5
|
end
|
6
6
|
end
|
File without changes
|
File without changes
|
@@ -5,12 +5,13 @@ class RemoveAwesomeNestedSetColumnsFromSpudPostCategories < ActiveRecord::Migrat
|
|
5
5
|
t.remove :lft, :rgt, :depth, :parent_id
|
6
6
|
end
|
7
7
|
end
|
8
|
+
|
8
9
|
def down
|
9
10
|
change_table :spud_post_categories do |t|
|
10
11
|
t.integer :lft
|
11
12
|
t.integer :rgt
|
12
13
|
t.integer :depth
|
13
|
-
t.
|
14
|
+
t.integer :parent_id
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
File without changes
|
@@ -3,13 +3,14 @@ class DropSpudPostSites < ActiveRecord::Migration
|
|
3
3
|
def up
|
4
4
|
drop_table :spud_post_sites
|
5
5
|
end
|
6
|
+
|
6
7
|
def down
|
7
8
|
create_table :spud_post_sites do |t|
|
8
|
-
t.integer :spud_post_id, :
|
9
|
-
t.integer :spud_site_id, :
|
9
|
+
t.integer :spud_post_id, null: false
|
10
|
+
t.integer :spud_site_id, null: false
|
10
11
|
t.timestamps
|
11
12
|
end
|
12
13
|
add_index :spud_post_sites, :spud_post_id
|
13
|
-
add_index :spud_post_sites, :spud_site_id
|
14
|
+
add_index :spud_post_sites, :spud_site_id
|
14
15
|
end
|
15
16
|
end
|