Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 15
- Log:
Attempt to update Typo to a Typo SVN HEAD release from around the
time the prototype installation was set up on the RISC OS Open Limited
web site. Timestamps place this at 04-Jul so a revision from 05-Jul or
earlier was pulled and copied over the 2.6.0 tarball stable code.
- Author:
- adh
- Date:
- Sat Jul 22 23:27:35 +0100 2006
- Size:
- 3819 Bytes
1 | class SuperclassComments < ActiveRecord::Migration |
2 | class BareComment < ActiveRecord::Base |
3 | include BareMigration |
4 | end |
5 | |
6 | class BareContent < ActiveRecord::Base |
7 | include BareMigration |
8 | set_inheritance_column :bogustype # see migration #20 for why |
9 | end |
10 | |
11 | def self.up |
12 | STDERR.puts "Merging Comments into Contents table" |
13 | # Get our indices into a known good state. |
14 | # Mutter dark imprecations at having to do this. |
15 | add_index(:comments, :article_id) rescue nil |
16 | remove_index(:contents, :article_id) rescue nil |
17 | modify_tables_and_update([:add_column, BareContent, :article_id, :integer], |
18 | [:add_column, BareContent, :email, :string ], |
19 | [:add_column, BareContent, :url, :string ], |
20 | [:add_column, BareContent, :ip, :string ], |
21 | [:add_index, BareContent, :article_id ]) do |
22 | BareContent.transaction do |
23 | if not $schema_generator |
24 | BareComment.find(:all).each do |c| |
25 | BareContent.create!(:type => 'Comment', |
26 | :article_id => c.article_id, |
27 | :author => c.author, |
28 | :email => c.email, |
29 | :url => c.url, |
30 | :ip => c.ip, |
31 | :body => c.body, |
32 | :body_html => c.body_html, |
33 | :created_at => c.created_at, |
34 | :updated_at => c.updated_at, |
35 | :user_id => c.user_id, |
36 | :guid => c.guid, |
37 | :whiteboard => c.whiteboard) |
38 | end |
39 | end |
40 | end |
41 | remove_index(:comments, :article_id) |
42 | end |
43 | drop_table :comments |
44 | end |
45 | |
46 | def self.init_comments_table(t) |
47 | t.column :article_id, :integer |
48 | t.column :title, :string |
49 | t.column :author, :string |
50 | t.column :email, :string |
51 | t.column :url, :string |
52 | t.column :ip, :string |
53 | t.column :body, :text |
54 | t.column :body_html, :text |
55 | t.column :created_at, :datetime |
56 | t.column :updated_at, :datetime |
57 | t.column :user_id, :integer |
58 | t.column :guid, :string |
59 | t.column :whiteboard, :text |
60 | end |
61 | |
62 | |
63 | def self.down |
64 | STDERR.puts "Recreating Comments from Contents table" |
65 | modify_tables_and_update([:create_table, BareComment, lambda {|t| self.init_comments_table(t)}], |
66 | [:add_index, BareComment, :article_id ]) do |
67 | BareContent.transaction do |
68 | BareComment.transaction do |
69 | BareContent.find(:all, :conditions => "type = 'Comment'").each do |c| |
70 | BareComment.create!(:article_id => c.article_id, |
71 | :title => c.title, |
72 | :author => c.author, |
73 | :email => c.email, |
74 | :url => c.url, |
75 | :ip => c.ip, |
76 | :body => c.body, |
77 | :body_html => c.body_html, |
78 | :created_at => c.created_at, |
79 | :updated_at => c.updated_at, |
80 | :user_id => c.user_id, |
81 | :guid => c.guid, |
82 | :whiteboard => c.whiteboard) |
83 | end |
84 | BareContent.delete_all "type = 'Comment'" |
85 | end |
86 | end |
87 | remove_index :contents, :article_id |
88 | remove_column :contents, :article_id |
89 | remove_column :contents, :email |
90 | remove_column :contents, :url |
91 | remove_column :contents, :ip |
92 | end |
93 | end |
94 | end |