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:
- 2766 Bytes
1 | class SuperclassTrackbacks < ActiveRecord::Migration |
2 | class BareContent < ActiveRecord::Base |
3 | include BareMigration |
4 | end |
5 | |
6 | class BareTrackback < ActiveRecord::Base |
7 | include BareMigration |
8 | end |
9 | |
10 | def self.up |
11 | STDERR.puts "Merging Trackbacks into Content table" |
12 | # Ensure that the index we're going to remove in the transaction |
13 | # is actually there (otherwise Postgres breaks) |
14 | add_index(:trackbacks, :article_id) rescue nil |
15 | modify_tables_and_update([:add_column, BareContent, :blog_name, :string], |
16 | [:remove_index, BareTrackback, :article_id ]) do |
17 | BareContent.transaction do |
18 | if not $schema_generator |
19 | BareTrackback.find(:all).each do |tb| |
20 | a = BareContent.find(tb.article_id) |
21 | BareContent.create(:type => 'Trackback', |
22 | :article_id => tb.article_id, |
23 | :blog_name => tb.blog_name, |
24 | :title => tb.title, |
25 | :excerpt => tb.excerpt, |
26 | :url => tb.url, |
27 | :ip => tb.ip, |
28 | :created_at => tb.created_at, |
29 | :updated_at => tb.updated_at, |
30 | :guid => tb.guid) |
31 | end |
32 | end |
33 | end |
34 | end |
35 | drop_table :trackbacks |
36 | end |
37 | |
38 | def self.transactions_init(t) |
39 | t.column :article_id, :integer |
40 | t.column :blog_name, :string |
41 | t.column :title, :string |
42 | t.column :excerpt, :string |
43 | t.column :url, :string |
44 | t.column :ip, :string |
45 | t.column :created_at, :datetime |
46 | t.column :updated_at, :datetime |
47 | t.column :guid, :string |
48 | end |
49 | |
50 | def self.down |
51 | STDOUT.puts "Recreating Trackbacks from Contents table" |
52 | modify_tables_and_update([:create_table, :trackbacks, lambda {|t| transactions_init(t)}], |
53 | [:add_index, :trackbacks, :article_id]) do |
54 | BareContent.transaction do |
55 | BareContent.find(:all, :conditions => ["type = ?", 'Trackback']).each do |tb| |
56 | BareTrackback.create(:article_id => tb.article_id, |
57 | :blog_name => tb.blog_name, |
58 | :title => tb.title, |
59 | :excerpt => tb.excerpt, |
60 | :url => tb.url, |
61 | :ip => tb.ip, |
62 | :created_at => tb.created_at, |
63 | :updated_at => tb.updated_at, |
64 | :guid => tb.guid) |
65 | end |
66 | BareContent.delete_all("type = 'Trackback'") |
67 | end |
68 | end |
69 | remove_column :contents, :blog_name |
70 | end |
71 | end |