EliteJournal 1.9.403 → 1.9.480
Sign up to get free protection for your applications and to get access to all the features.
- data/app/controllers/application.rb +6 -4
- data/app/controllers/atom_controller.rb +10 -17
- data/app/controllers/post_controller.rb +67 -36
- data/app/controllers/rss_controller.rb +12 -17
- data/app/controllers/tags_controller.rb +2 -2
- data/app/controllers/users_controller.rb +9 -3
- data/app/helpers/application_helper.rb +13 -23
- data/app/helpers/pagination_helper.rb +487 -0
- data/app/helpers/tags_helper.rb +1 -1
- data/app/models/post.rb +2 -0
- data/app/models/user.rb +4 -4
- data/app/views/account/info.rhtml +4 -0
- data/app/views/atom/feed.rxml +2 -2
- data/app/views/css/edit.rhtml +1 -1
- data/app/views/layouts/application.rhtml +5 -5
- data/app/views/{journal → post}/_comment.rhtml +1 -1
- data/app/views/{journal → post}/_post.rhtml +3 -3
- data/app/views/{journal → post}/_trackback.rhtml +0 -0
- data/app/views/{journal → post}/error.rhtml +0 -0
- data/app/views/post/index.rhtml +5 -0
- data/app/views/post/reply.rhtml +21 -12
- data/app/views/post/replyxml.rxml +2 -2
- data/app/views/{journal → post}/view.rhtml +0 -0
- data/app/views/rss/{index.rxml → feed.rxml} +1 -1
- data/app/views/users/index.rhtml +1 -1
- data/config/environment.rb +22 -9
- data/config/routes.rb +36 -0
- data/db/db-mysql.sql +2 -0
- data/db/db-postgresql.sql +2 -0
- data/db/db-sqlite.sql +2 -0
- data/db/development_structure.sql +67 -65
- data/elitejournal +3 -40
- data/public/dispatch.rb +2 -2
- metadata +12 -22
- data/app/controllers/journal_controller.rb +0 -53
- data/app/helpers/journal_helper.rb +0 -2
- data/app/views/journal/index.rhtml +0 -1
data/app/helpers/tags_helper.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module TagsHelper
|
2
2
|
def show_tags(tags)
|
3
3
|
links = []
|
4
|
-
tags.each { |t| links << link_to(t.tag, :controller => '
|
4
|
+
tags.each { |t| links << link_to(t.tag, :controller => 'tags', :action => 'show', :tag => t.tag)}
|
5
5
|
links.join(', ')
|
6
6
|
end
|
7
7
|
end
|
data/app/models/post.rb
CHANGED
@@ -17,6 +17,8 @@ class Post < ActiveRecord::Base
|
|
17
17
|
RedCloth.new(section).to_html.gsub(/\t/, '')
|
18
18
|
end
|
19
19
|
self.rendered = @sections.join(SECTION_DELIMITER)
|
20
|
+
|
21
|
+
self.slug = self.subject.downcase.gsub(/[^a-z0-9 _-]+/, '').gsub(/ +/, '-').gsub(/-+/, '-')
|
20
22
|
end
|
21
23
|
|
22
24
|
def updated?
|
data/app/models/user.rb
CHANGED
@@ -11,6 +11,7 @@ class User < ActiveRecord::Base
|
|
11
11
|
validates_presence_of :username, :name
|
12
12
|
validates_uniqueness_of :username
|
13
13
|
validates_confirmation_of :password
|
14
|
+
validates_inclusion_of :posts_per_page, :in => 1..25
|
14
15
|
|
15
16
|
def before_save
|
16
17
|
self.password = password.empty? ? self.class.find(id).password : Digest::MD5.hexdigest(password)
|
@@ -22,10 +23,9 @@ class User < ActiveRecord::Base
|
|
22
23
|
end
|
23
24
|
|
24
25
|
def top_posters(n=5)
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
posters.map { |p| find(p) }
|
26
|
+
find_by_sql ["SELECT u.*, COUNT(p.id) FROM #{table_name} u, " +
|
27
|
+
"#{Post.table_name} p WHERE u.id = p.user_id " +
|
28
|
+
"GROUP BY u.id ORDER_BY post_count DESC LIMIT ?", n]
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -12,6 +12,10 @@
|
|
12
12
|
|
13
13
|
<p><label for="user_subtitle">Journal Subtitle</label><br /><%= text_field('user', 'subtitle') %></p>
|
14
14
|
|
15
|
+
<p><label>Show the
|
16
|
+
<%= text_field 'user', 'posts_per_page', :size => 2, :style => 'width: auto' %>
|
17
|
+
most recent posts on my user page</label></p>
|
18
|
+
|
15
19
|
<p><label for="user_allows_comments">Allow Commenting?</label> <%= check_box('user', 'allows_comment', 'style' => 'width: auto;') %></p>
|
16
20
|
<p><label for="user_password">Password</label><br />
|
17
21
|
<input type="password" name="user[password]" id="user_password" size="30" /></p>
|
data/app/views/atom/feed.rxml
CHANGED
@@ -5,8 +5,8 @@ xml.feed('version' => '0.3', 'xmlns' => 'http://purl.org/atom/ns#') do
|
|
5
5
|
@posts.each do |p|
|
6
6
|
xml.entry do
|
7
7
|
xml.title p.subject
|
8
|
-
xml.link 'rel' => 'alternate', 'type' => 'text/html', 'href' => "
|
9
|
-
xml.author { xml.name p.user.name }
|
8
|
+
xml.link 'rel' => 'alternate', 'type' => 'text/html', 'href' => "#{@request.protocol}#{@request.host_with_port}/user/#{@user ? @user.name : p.user.username}/#{p.slug}"
|
9
|
+
xml.author { xml.name @user ? @user.name : p.user.name }
|
10
10
|
xml.issued p.created_at.xmlschema
|
11
11
|
xml.modified p.updated_at.xmlschema
|
12
12
|
xml.content({'type' => 'text/html', 'mode' => 'escaped'}, p.rendered)
|
data/app/views/css/edit.rhtml
CHANGED
@@ -29,7 +29,7 @@
|
|
29
29
|
<ul id="menu">
|
30
30
|
<% if logged_in? -%>
|
31
31
|
<li id="logout"><%= current_user.name %> | <%= link_to 'Log Out', :controller => 'auth', :action => 'logout' %></li>
|
32
|
-
<li><%= link_to('Home', :controller => '
|
32
|
+
<li><%= link_to('Home', :controller => 'post', :action => 'index' ) %></li>
|
33
33
|
<li><%= link_to('Users', :controller => 'users', :action => 'index' ) %></li>
|
34
34
|
<li><%= link_to('Post', :controller => 'post', :action => 'new' ) %></li>
|
35
35
|
<li><%= link_to('My Drafts', :controller => 'draft', :action => 'list' ) %></li>
|
@@ -41,7 +41,7 @@
|
|
41
41
|
<% end -%>
|
42
42
|
<% else -%>
|
43
43
|
<li id="logout"><%= link_to 'Log In', :controller => 'auth', :action => 'login' %></li>
|
44
|
-
<li><%= link_to 'Home', :controller => '
|
44
|
+
<li><%= link_to 'Home', :controller => 'post', :action => 'index' %></li>
|
45
45
|
<li><%= link_to('Users', :controller => 'users', :action => 'index' ) %></li>
|
46
46
|
<% end -%>
|
47
47
|
</ul>
|
@@ -61,8 +61,8 @@
|
|
61
61
|
<% if user_page? -%>
|
62
62
|
<h2>Links</h2>
|
63
63
|
<ul>
|
64
|
-
<li><%= link_to 'Atom', :controller => 'atom', :action => @user.username %></li>
|
65
|
-
<li><%= link_to 'RSS', :controller => 'rss', :action => @user.username %></li>
|
64
|
+
<li><%= link_to 'Atom', :controller => 'atom', :action => 'feed', :user => @user.username %></li>
|
65
|
+
<li><%= link_to 'RSS', :controller => 'rss', :action => 'index', :user => @user.username %></li>
|
66
66
|
<% @user.links.each do |l| -%>
|
67
67
|
<li><a href="<%= l.link_url %>"><%= l.link_text %></a></li>
|
68
68
|
<% end -%>
|
@@ -73,7 +73,7 @@
|
|
73
73
|
<h2>Related Tags</h2>
|
74
74
|
<ul>
|
75
75
|
<% @tag.related_tags.each do |t| -%>
|
76
|
-
<li><%= link_to t.tag, :controller => 'tags', :action => 'show', :
|
76
|
+
<li><%= link_to t.tag, :controller => 'tags', :action => 'show', :tag => CGI.escape(t.tag) %></li>
|
77
77
|
<% end -%>
|
78
78
|
</ul>
|
79
79
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<div class="comment">
|
2
2
|
<a name="comment_<%= comment.id %>"></a>
|
3
|
-
<b><%= comment.subject %></b> (<%= link_to('Reply', :controller => 'post', :action => 'reply', :
|
3
|
+
<b><%= comment.subject %></b> (<%= link_to('Reply', :controller => 'post', :action => 'reply', :user => comment.post.user.username, :id => comment.id, :slug => comment.post.slug) %>) <% if owns_post?(comment.post) %>(<%= link_to 'Delete', :controller => 'post', :action => 'destroy_comment', :id => comment.id %>)<% end %><br />
|
4
4
|
Posted <%= distance_of_time_in_words comment.post.created_at, comment.created_at %> later by <em><%= comment.posted_by %></em><br /><br />
|
5
5
|
<%= comment.rendered %>
|
6
6
|
|
@@ -3,8 +3,8 @@
|
|
3
3
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
4
4
|
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
|
5
5
|
<rdf:Description
|
6
|
-
rdf:about="<%= url_for :controller => '
|
7
|
-
dc:identifier="<%= url_for :controller => '
|
6
|
+
rdf:about="<%= url_for :controller => 'post', :action => 'view', :user => post.user.username, :slug => post.slug %>"
|
7
|
+
dc:identifier="<%= url_for :controller => 'post', :action => 'view', :user => post.user.username, :slug => post.slug %>"
|
8
8
|
dc:title="<%= post.subject %>"
|
9
9
|
trackback:ping="<%= url_for :controller => 'ping', :action => 'trackback', :id => post.id, :only_path => false %>" />
|
10
10
|
</rdf:RDF>
|
@@ -14,7 +14,7 @@ trackback:ping="<%= url_for :controller => 'ping', :action => 'trackback', :id =
|
|
14
14
|
<div class="face"><%= user_face(post.user) %></div>
|
15
15
|
|
16
16
|
<ul class="postdata" id="postdata_<%= post.id %>">
|
17
|
-
<li>Posted by <%= link_user(post.user) %> on <%= sexifytime post.created_at %>.</li>
|
17
|
+
<li>Posted by <%= link_user(post.user) %> on <%= sexifytime post.created_at, post.user.username %>.</li>
|
18
18
|
<% if post.has_tags? %><li id="posttags_<%= post.id %>">Tags: <%= tag_links(post) %></li><% end %>
|
19
19
|
<li>Trackback URL: <%= url_for :controller => 'ping', :action => 'trackback', :id => post.id, :only_path => false %></li>
|
20
20
|
<% if owns_post?(post) -%>
|
File without changes
|
File without changes
|
data/app/views/post/reply.rhtml
CHANGED
@@ -1,22 +1,31 @@
|
|
1
|
-
<div class="post">
|
2
|
-
|
3
|
-
<
|
4
|
-
|
1
|
+
<div class="postsubject" id="postsubject_<%= @post.id %>"><h2><%= @post.subject %></h2></div>
|
2
|
+
<div id="postdiv_<%= @post.id %>" class="post">
|
3
|
+
<div class="face"><%= user_face(@post.user) %></div>
|
4
|
+
|
5
|
+
<ul class="postdata" id="postdata_<%= @post.id %>">
|
6
|
+
<li>Posted by <%= link_user(@post.user) %> on <%= sexifytime @post.created_at, @post.user.username %>.</li>
|
7
|
+
<% if @post.has_tags? %><li id="posttags_<%= @post.id %>">Tags: <%= tag_links(@post) %></li><% end %>
|
5
8
|
<li>Trackback URL: <%= url_for :controller => 'ping', :action => 'trackback', :id => @post.id, :only_path => false %></li>
|
6
|
-
<% if @post
|
7
|
-
<li>
|
8
|
-
|
9
|
+
<% if owns_post?(@post) -%>
|
10
|
+
<li>Admin <%= link_to('Edit', {:controller => 'post', :action => 'edit', :id => @post.id}, {'onclick' => "return setupEditInPlace('#{@post.id}')"}) %> <%= link_to('Delete', {:controller => 'post', :action => 'destroy', :id => @post.id}, {'onclick' => "return deletePost('#{@post.id}')"}) %></li>
|
11
|
+
<li id="togglecomment_<%= @post.id %>"><%= comment_toggle_link(@post) %></li>
|
12
|
+
<% end -%>
|
9
13
|
</ul>
|
14
|
+
|
15
|
+
<div class="postbody" id="postbody_<%= @post.id %>">
|
10
16
|
<%= render_body(@post) %>
|
17
|
+
</div>
|
11
18
|
|
12
19
|
<% if @comment -%>
|
13
|
-
<
|
14
|
-
|
15
|
-
|
16
|
-
|
20
|
+
<div class="commentreply">
|
21
|
+
<b><%= @comment.subject %></b><br />
|
22
|
+
Posted On <%= @comment.created_at %> By <%= @comment.posted_by %><br />
|
23
|
+
<%= @comment.rendered %>
|
24
|
+
<br />
|
25
|
+
</div>
|
17
26
|
<% end -%>
|
18
27
|
|
19
|
-
<form id="postreply" action="<%= url_for :controller => 'post', :action => 'reply', :
|
28
|
+
<form id="postreply" action="<%= url_for :controller => 'post', :action => 'reply', :user => @post.user.username, :slug => @post.slug %>" method="post">
|
20
29
|
<div style="visibility: hidden;">
|
21
30
|
<% if @comment -%>
|
22
31
|
<input type="hidden" name="newcomment[comment_id]" value="<%= @comment.id %>" />
|
@@ -1,5 +1,5 @@
|
|
1
1
|
xml.result do
|
2
2
|
xml.postid @post.id
|
3
3
|
xml.comments @post.comments.count
|
4
|
-
xml.message link_to("Reply Posted (View)", :controller => '
|
5
|
-
end
|
4
|
+
xml.message link_to("Reply Posted (View)", :controller => 'post', :action => 'view', :user => post.user.username, :slug => post.slug, :anchor => "comment_#{@comment.id}")
|
5
|
+
end
|
File without changes
|
@@ -6,7 +6,7 @@ xml.rss('version' => '2.0') do
|
|
6
6
|
@posts.each { |p|
|
7
7
|
xml.item do
|
8
8
|
xml.title(p.subject)
|
9
|
-
xml.link("#{@request.protocol}#{@request.host_with_port}/
|
9
|
+
xml.link("#{@request.protocol}#{@request.host_with_port}/user/#{@user ? @user.username : p.user.username}/#{p.slug}")
|
10
10
|
xml.description(p.rendered)
|
11
11
|
xml.pubDate(p.updated_at)
|
12
12
|
end
|
data/app/views/users/index.rhtml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
<dl>
|
2
2
|
<% @users.each do |u| -%>
|
3
3
|
<dt><%= link_to u.username, :controller => 'users', :action => u.username %></dt>
|
4
|
-
<dd><%= u.name %>, <%= u.posts.count %> posts. <% if u.posts.first %>Last posted on <%= link_to u.posts.first.created_at.strftime('%D'), :controller => '
|
4
|
+
<dd><%= u.name %>, <%= u.posts.count %> posts. <% if u.posts.first %>Last posted on <%= link_to u.posts.first.created_at.strftime('%D'), :controller => 'post', :action => 'view', :user => u.username, :slug => u.posts.first.slug %>.<% end %></dd>
|
5
5
|
<% end -%>
|
6
6
|
</dl>
|
data/config/environment.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
RAILS_ROOT = File.
|
1
|
+
RAILS_ROOT = File.dirname(__FILE__) + "/../"
|
2
2
|
RAILS_ENV = ENV['RAILS_ENV'] || 'development'
|
3
3
|
|
4
4
|
|
@@ -14,6 +14,7 @@ ADDITIONAL_LOAD_PATHS.concat %w(
|
|
14
14
|
app/models
|
15
15
|
app/controllers
|
16
16
|
app/helpers
|
17
|
+
app/apis
|
17
18
|
config
|
18
19
|
lib
|
19
20
|
vendor
|
@@ -25,9 +26,11 @@ ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(di
|
|
25
26
|
|
26
27
|
# Require Rails gems.
|
27
28
|
require 'rubygems'
|
29
|
+
require_gem 'activesupport'
|
28
30
|
require_gem 'activerecord'
|
29
31
|
require_gem 'actionpack'
|
30
32
|
require_gem 'actionmailer'
|
33
|
+
require_gem 'actionwebservice'
|
31
34
|
require_gem 'rails'
|
32
35
|
|
33
36
|
|
@@ -40,19 +43,29 @@ if RAILS_ENV == 'geminstall'
|
|
40
43
|
else
|
41
44
|
ActiveRecord::Base.configurations = YAML::load(File.open("#{RAILS_ROOT}/config/database.yml"))
|
42
45
|
end
|
43
|
-
|
44
46
|
ActiveRecord::Base.establish_connection
|
45
47
|
|
46
|
-
|
47
48
|
# Configure defaults if the included environment did not.
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
49
|
+
begin
|
50
|
+
RAILS_DEFAULT_LOGGER = Logger.new("#{RAILS_ROOT}/log/#{RAILS_ENV}.log") unless RAILS_ENV == 'geminstall'
|
51
|
+
rescue StandardError
|
52
|
+
RAILS_DEFAULT_LOGGER = Logger.new(STDERR)
|
53
|
+
RAILS_DEFAULT_LOGGER.level = Logger::WARN
|
54
|
+
RAILS_DEFAULT_LOGGER.warn(
|
55
|
+
"Rails Error: Unable to access log file. Please ensure that log/#{RAILS_ENV}.log exists and is chmod 0666. " +
|
56
|
+
"The log level has been raised to WARN and the output directed to STDERR until the problem is fixed."
|
57
|
+
)
|
54
58
|
end
|
55
59
|
|
60
|
+
[ActiveRecord, ActionController, ActionMailer].each { |mod| mod::Base.logger ||= RAILS_DEFAULT_LOGGER }
|
61
|
+
[ActionController, ActionMailer].each { |mod| mod::Base.template_root ||= "#{RAILS_ROOT}/app/views/" }
|
62
|
+
ActionController::Routing::Routes.reload
|
63
|
+
|
64
|
+
Controllers = Dependencies::LoadingModule.root(
|
65
|
+
File.expand_path(File.join(RAILS_ROOT, 'app', 'controllers')),
|
66
|
+
File.expand_path(File.join(RAILS_ROOT, 'components'))
|
67
|
+
)
|
68
|
+
|
56
69
|
|
57
70
|
# Include your app's configuration here:
|
58
71
|
#ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update(:database_manager => CGI::Session::ActiveRecordStore)
|
data/config/routes.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
ActionController::Routing::Routes.draw do |map|
|
2
|
+
map.connect '', :controller => 'post', :action => 'index'
|
3
|
+
|
4
|
+
map.connect ':user/:slug/view', :controller => 'post', :action => 'view'
|
5
|
+
|
6
|
+
map.connect ':year/:month/:day', :controller => 'post', :action => 'range', :year => /\d{4}/, :month => /\d{1,2}/, :day => /\d{1,2}/, :defaults => {:month => nil, :day => nil}
|
7
|
+
|
8
|
+
map.connect ':user/:year/:month/:day', :controller => 'post', :action => 'range', :year => /\d{4}/, :month => /\d{1,2}/, :day => /\d{1,2}/, :defaults => {:month => nil, :day => nil }
|
9
|
+
|
10
|
+
map.connect ':user/rss', :controller => 'rss', :action => 'feed'
|
11
|
+
|
12
|
+
map.connect ':user/atom', :controller => 'atom', :action => 'feed'
|
13
|
+
|
14
|
+
map.connect 'rss/master', :controller => 'rss', :action => 'feed'
|
15
|
+
|
16
|
+
map.connect 'atom/master', :controller => 'atom', :action => 'feed'
|
17
|
+
|
18
|
+
map.connect 'tag/:tag', :controller => 'tags', :action => 'show'
|
19
|
+
|
20
|
+
map.connect ':user/:slug/reply', :controller => 'post', :action => 'reply'
|
21
|
+
|
22
|
+
map.connect ':user/:slug/comment/:id/reply', :controller => 'post', :action => 'reply'
|
23
|
+
|
24
|
+
map.connect ':user/:slug/tag', :controller => 'post', :action => 'tag'
|
25
|
+
|
26
|
+
map.connect 'drafts', :controller => 'draft', :action => 'list'
|
27
|
+
|
28
|
+
map.connect 'me', :controller => 'account', :action => 'info'
|
29
|
+
|
30
|
+
map.connect 'links', :controller => 'link', :action => 'index'
|
31
|
+
|
32
|
+
map.connect 'css', :controller => 'css', :action => 'edit'
|
33
|
+
|
34
|
+
map.connect ':controller/:action/:id'
|
35
|
+
|
36
|
+
end
|
data/db/db-mysql.sql
CHANGED
@@ -4,6 +4,7 @@ CREATE TABLE posts (
|
|
4
4
|
created_at DATETIME,
|
5
5
|
updated_at DATETIME,
|
6
6
|
subject VARCHAR(255) NOT NULL,
|
7
|
+
slug VARCHAR(255) NOT NULL,
|
7
8
|
body TEXT NOT NULL,
|
8
9
|
rendered TEXT NOT NULL DEFAULT '',
|
9
10
|
allows_comment TINYINT NOT NULL DEFAULT 1,
|
@@ -51,6 +52,7 @@ CREATE TABLE users (
|
|
51
52
|
name VARCHAR(255) NOT NULL,
|
52
53
|
is_admin TINYINT NOT NULL DEFAULT 0,
|
53
54
|
allows_comment TINYINT NOT NULL DEFAULT 1,
|
55
|
+
posts_per_page INT NOT NULL DEFAULT 10,
|
54
56
|
title VARCHAR(255) DEFAULT '',
|
55
57
|
subtitle VARCHAR(255) DEFAULT '',
|
56
58
|
PRIMARY KEY (id)
|
data/db/db-postgresql.sql
CHANGED
@@ -4,6 +4,7 @@ CREATE TABLE posts (
|
|
4
4
|
created_at TIMESTAMP,
|
5
5
|
updated_at TIMESTAMP,
|
6
6
|
subject VARCHAR(255) NOT NULL,
|
7
|
+
slug VARCHAR(255) NOT NULL,
|
7
8
|
body TEXT NOT NULL,
|
8
9
|
rendered TEXT NOT NULL DEFAULT '',
|
9
10
|
allows_comment BOOLEAN NOT NULL DEFAULT 't',
|
@@ -51,6 +52,7 @@ CREATE TABLE users (
|
|
51
52
|
name VARCHAR(255) NOT NULL,
|
52
53
|
is_admin BOOLEAN NOT NULL DEFAULT 'f',
|
53
54
|
allows_comment BOOLEAN NOT NULL DEFAULT 't',
|
55
|
+
posts_per_page INT NOT NULL DEFAULT 10,
|
54
56
|
title VARCHAR(255) DEFAULT '',
|
55
57
|
subtitle VARCHAR(255) DEFAULT '',
|
56
58
|
PRIMARY KEY (id)
|
data/db/db-sqlite.sql
CHANGED
@@ -4,6 +4,7 @@ CREATE TABLE posts (
|
|
4
4
|
created_at DATETIME,
|
5
5
|
updated_at DATETIME,
|
6
6
|
subject VARCHAR(255) NOT NULL,
|
7
|
+
slug VARCHAR(255) NOT NULL,
|
7
8
|
body TEXT NOT NULL,
|
8
9
|
rendered TEXT NOT NULL DEFAULT '',
|
9
10
|
allows_comment TINYINT NOT NULL DEFAULT '1',
|
@@ -51,6 +52,7 @@ CREATE TABLE users (
|
|
51
52
|
name VARCHAR(255) NOT NULL,
|
52
53
|
is_admin TINYINT NOT NULL DEFAULT '0',
|
53
54
|
allows_comment TINYINT NOT NULL DEFAULT '1',
|
55
|
+
posts_per_page INTEGER NOT NULL DEFAULT 10,
|
54
56
|
title VARCHAR(255) DEFAULT '',
|
55
57
|
subtitle VARCHAR(255) DEFAULT '',
|
56
58
|
PRIMARY KEY (id)
|
@@ -21,7 +21,7 @@ SET SESSION AUTHORIZATION 'scott';
|
|
21
21
|
SET search_path = public, pg_catalog;
|
22
22
|
|
23
23
|
--
|
24
|
-
-- TOC entry 5 (OID
|
24
|
+
-- TOC entry 5 (OID 731131)
|
25
25
|
-- Name: posts; Type: TABLE; Schema: public; Owner: scott
|
26
26
|
--
|
27
27
|
|
@@ -31,6 +31,7 @@ CREATE TABLE posts (
|
|
31
31
|
created_at timestamp without time zone,
|
32
32
|
updated_at timestamp without time zone,
|
33
33
|
subject character varying(255) NOT NULL,
|
34
|
+
slug character varying(255) NOT NULL,
|
34
35
|
body text NOT NULL,
|
35
36
|
rendered text DEFAULT ''::text NOT NULL,
|
36
37
|
allows_comment boolean DEFAULT true NOT NULL
|
@@ -38,7 +39,7 @@ CREATE TABLE posts (
|
|
38
39
|
|
39
40
|
|
40
41
|
--
|
41
|
-
-- TOC entry 6 (OID
|
42
|
+
-- TOC entry 6 (OID 731143)
|
42
43
|
-- Name: tags; Type: TABLE; Schema: public; Owner: scott
|
43
44
|
--
|
44
45
|
|
@@ -50,7 +51,7 @@ CREATE TABLE tags (
|
|
50
51
|
|
51
52
|
|
52
53
|
--
|
53
|
-
-- TOC entry 7 (OID
|
54
|
+
-- TOC entry 7 (OID 731149)
|
54
55
|
-- Name: posts_tags; Type: TABLE; Schema: public; Owner: scott
|
55
56
|
--
|
56
57
|
|
@@ -61,7 +62,7 @@ CREATE TABLE posts_tags (
|
|
61
62
|
|
62
63
|
|
63
64
|
--
|
64
|
-
-- TOC entry 8 (OID
|
65
|
+
-- TOC entry 8 (OID 731153)
|
65
66
|
-- Name: drafts; Type: TABLE; Schema: public; Owner: scott
|
66
67
|
--
|
67
68
|
|
@@ -76,7 +77,7 @@ CREATE TABLE drafts (
|
|
76
77
|
|
77
78
|
|
78
79
|
--
|
79
|
-
-- TOC entry 9 (OID
|
80
|
+
-- TOC entry 9 (OID 731164)
|
80
81
|
-- Name: comments; Type: TABLE; Schema: public; Owner: scott
|
81
82
|
--
|
82
83
|
|
@@ -93,81 +94,82 @@ CREATE TABLE comments (
|
|
93
94
|
|
94
95
|
|
95
96
|
--
|
96
|
-
-- TOC entry 10 (OID
|
97
|
-
-- Name:
|
97
|
+
-- TOC entry 10 (OID 731179)
|
98
|
+
-- Name: users; Type: TABLE; Schema: public; Owner: scott
|
98
99
|
--
|
99
100
|
|
100
|
-
CREATE TABLE
|
101
|
+
CREATE TABLE users (
|
101
102
|
id serial NOT NULL,
|
102
|
-
|
103
|
+
username character varying(255) NOT NULL,
|
104
|
+
"password" character varying(255) NOT NULL,
|
105
|
+
name character varying(255) NOT NULL,
|
106
|
+
is_admin boolean DEFAULT false NOT NULL,
|
107
|
+
allows_comment boolean DEFAULT true NOT NULL,
|
108
|
+
posts_per_page integer DEFAULT 10 NOT NULL,
|
103
109
|
title character varying(255) DEFAULT ''::character varying,
|
104
|
-
|
105
|
-
url character varying(255) DEFAULT ''::character varying,
|
106
|
-
blog_name character varying(255) DEFAULT ''::character varying
|
110
|
+
subtitle character varying(255) DEFAULT ''::character varying
|
107
111
|
);
|
108
112
|
|
109
113
|
|
110
114
|
--
|
111
|
-
-- TOC entry 11 (OID
|
112
|
-
-- Name:
|
115
|
+
-- TOC entry 11 (OID 731191)
|
116
|
+
-- Name: images; Type: TABLE; Schema: public; Owner: scott
|
113
117
|
--
|
114
118
|
|
115
|
-
CREATE TABLE
|
119
|
+
CREATE TABLE images (
|
116
120
|
id serial NOT NULL,
|
121
|
+
"type" character varying(25) NOT NULL,
|
117
122
|
user_id integer NOT NULL,
|
118
|
-
|
119
|
-
|
123
|
+
picture bytea NOT NULL,
|
124
|
+
content_type character varying(255) NOT NULL,
|
125
|
+
height character varying(4) NOT NULL,
|
126
|
+
width character varying(4) NOT NULL,
|
127
|
+
updated_at timestamp without time zone
|
120
128
|
);
|
121
129
|
|
122
130
|
|
123
131
|
--
|
124
|
-
-- TOC entry 12 (OID
|
125
|
-
-- Name:
|
132
|
+
-- TOC entry 12 (OID 731201)
|
133
|
+
-- Name: pings; Type: TABLE; Schema: public; Owner: scott
|
126
134
|
--
|
127
135
|
|
128
|
-
CREATE TABLE
|
136
|
+
CREATE TABLE pings (
|
129
137
|
id serial NOT NULL,
|
130
|
-
|
131
|
-
|
138
|
+
post_id integer DEFAULT 0 NOT NULL,
|
139
|
+
title character varying(255) DEFAULT ''::character varying,
|
140
|
+
excerpt character varying(255) DEFAULT ''::character varying,
|
141
|
+
url character varying(255) DEFAULT ''::character varying,
|
142
|
+
blog_name character varying(255) DEFAULT ''::character varying
|
132
143
|
);
|
133
144
|
|
134
145
|
|
135
146
|
--
|
136
|
-
-- TOC entry 13 (OID
|
137
|
-
-- Name:
|
147
|
+
-- TOC entry 13 (OID 731213)
|
148
|
+
-- Name: links; Type: TABLE; Schema: public; Owner: scott
|
138
149
|
--
|
139
150
|
|
140
|
-
CREATE TABLE
|
151
|
+
CREATE TABLE links (
|
141
152
|
id serial NOT NULL,
|
142
|
-
"type" character varying(25) NOT NULL,
|
143
153
|
user_id integer NOT NULL,
|
144
|
-
|
145
|
-
|
146
|
-
height character varying(4) NOT NULL,
|
147
|
-
width character varying(4) NOT NULL,
|
148
|
-
updated_at timestamp without time zone
|
154
|
+
link_text character varying(255) NOT NULL,
|
155
|
+
link_url character varying(255) NOT NULL
|
149
156
|
);
|
150
157
|
|
151
158
|
|
152
159
|
--
|
153
|
-
-- TOC entry 14 (OID
|
154
|
-
-- Name:
|
160
|
+
-- TOC entry 14 (OID 731220)
|
161
|
+
-- Name: stylesheets; Type: TABLE; Schema: public; Owner: scott
|
155
162
|
--
|
156
163
|
|
157
|
-
CREATE TABLE
|
164
|
+
CREATE TABLE stylesheets (
|
158
165
|
id serial NOT NULL,
|
159
|
-
|
160
|
-
|
161
|
-
name character varying(255) NOT NULL,
|
162
|
-
is_admin boolean DEFAULT false NOT NULL,
|
163
|
-
allows_comment boolean DEFAULT true NOT NULL,
|
164
|
-
title character varying(255) DEFAULT ''::character varying,
|
165
|
-
subtitle character varying(255) DEFAULT ''::character varying
|
166
|
+
user_id integer NOT NULL,
|
167
|
+
data text DEFAULT ''::text NOT NULL
|
166
168
|
);
|
167
169
|
|
168
170
|
|
169
171
|
--
|
170
|
-
-- TOC entry 15 (OID
|
172
|
+
-- TOC entry 15 (OID 731139)
|
171
173
|
-- Name: posts_pkey; Type: CONSTRAINT; Schema: public; Owner: scott
|
172
174
|
--
|
173
175
|
|
@@ -176,7 +178,7 @@ ALTER TABLE ONLY posts
|
|
176
178
|
|
177
179
|
|
178
180
|
--
|
179
|
-
-- TOC entry 16 (OID
|
181
|
+
-- TOC entry 16 (OID 731147)
|
180
182
|
-- Name: tags_pkey; Type: CONSTRAINT; Schema: public; Owner: scott
|
181
183
|
--
|
182
184
|
|
@@ -185,7 +187,7 @@ ALTER TABLE ONLY tags
|
|
185
187
|
|
186
188
|
|
187
189
|
--
|
188
|
-
-- TOC entry 17 (OID
|
190
|
+
-- TOC entry 17 (OID 731160)
|
189
191
|
-- Name: drafts_pkey; Type: CONSTRAINT; Schema: public; Owner: scott
|
190
192
|
--
|
191
193
|
|
@@ -194,7 +196,7 @@ ALTER TABLE ONLY drafts
|
|
194
196
|
|
195
197
|
|
196
198
|
--
|
197
|
-
-- TOC entry 18 (OID
|
199
|
+
-- TOC entry 18 (OID 731175)
|
198
200
|
-- Name: comments_pkey; Type: CONSTRAINT; Schema: public; Owner: scott
|
199
201
|
--
|
200
202
|
|
@@ -203,48 +205,48 @@ ALTER TABLE ONLY comments
|
|
203
205
|
|
204
206
|
|
205
207
|
--
|
206
|
-
-- TOC entry 19 (OID
|
207
|
-
-- Name:
|
208
|
+
-- TOC entry 19 (OID 731187)
|
209
|
+
-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: scott
|
208
210
|
--
|
209
211
|
|
210
|
-
ALTER TABLE ONLY
|
211
|
-
ADD CONSTRAINT
|
212
|
+
ALTER TABLE ONLY users
|
213
|
+
ADD CONSTRAINT users_pkey PRIMARY KEY (id);
|
212
214
|
|
213
215
|
|
214
216
|
--
|
215
|
-
-- TOC entry 20 (OID
|
216
|
-
-- Name:
|
217
|
+
-- TOC entry 20 (OID 731197)
|
218
|
+
-- Name: images_pkey; Type: CONSTRAINT; Schema: public; Owner: scott
|
217
219
|
--
|
218
220
|
|
219
|
-
ALTER TABLE ONLY
|
220
|
-
ADD CONSTRAINT
|
221
|
+
ALTER TABLE ONLY images
|
222
|
+
ADD CONSTRAINT images_pkey PRIMARY KEY (id);
|
221
223
|
|
222
224
|
|
223
225
|
--
|
224
|
-
-- TOC entry 21 (OID
|
225
|
-
-- Name:
|
226
|
+
-- TOC entry 21 (OID 731209)
|
227
|
+
-- Name: pings_pkey; Type: CONSTRAINT; Schema: public; Owner: scott
|
226
228
|
--
|
227
229
|
|
228
|
-
ALTER TABLE ONLY
|
229
|
-
ADD CONSTRAINT
|
230
|
+
ALTER TABLE ONLY pings
|
231
|
+
ADD CONSTRAINT pings_pkey PRIMARY KEY (id);
|
230
232
|
|
231
233
|
|
232
234
|
--
|
233
|
-
-- TOC entry 22 (OID
|
234
|
-
-- Name:
|
235
|
+
-- TOC entry 22 (OID 731216)
|
236
|
+
-- Name: links_pkey; Type: CONSTRAINT; Schema: public; Owner: scott
|
235
237
|
--
|
236
238
|
|
237
|
-
ALTER TABLE ONLY
|
238
|
-
ADD CONSTRAINT
|
239
|
+
ALTER TABLE ONLY links
|
240
|
+
ADD CONSTRAINT links_pkey PRIMARY KEY (id);
|
239
241
|
|
240
242
|
|
241
243
|
--
|
242
|
-
-- TOC entry 23 (OID
|
243
|
-
-- Name:
|
244
|
+
-- TOC entry 23 (OID 731227)
|
245
|
+
-- Name: stylesheets_pkey; Type: CONSTRAINT; Schema: public; Owner: scott
|
244
246
|
--
|
245
247
|
|
246
|
-
ALTER TABLE ONLY
|
247
|
-
ADD CONSTRAINT
|
248
|
+
ALTER TABLE ONLY stylesheets
|
249
|
+
ADD CONSTRAINT stylesheets_pkey PRIMARY KEY (id);
|
248
250
|
|
249
251
|
|
250
252
|
--
|