Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 71
- Log:
Start of upgrade to Typo 4.0.0, the latest stable release since
2.6.0. Note test/mocks/themes/azure changes from a file to a
directory, so the file has been removed in this revision and
the directory will be added in the next revision.
- Author:
- adh
- Date:
- Mon Aug 07 22:18:11 +0100 2006
- Size:
- 2836 Bytes
1 | class SuperclassTrackbacks < ActiveRecord::Migration |
2 | class BareContent < ActiveRecord::Base |
3 | include BareMigration |
4 | set_inheritance_column :bogustype # see migration #20 for why |
5 | end |
6 | |
7 | class BareTrackback < ActiveRecord::Base |
8 | include BareMigration |
9 | end |
10 | |
11 | def self.up |
12 | STDERR.puts "Merging Trackbacks into Content table" |
13 | # Ensure that the index we're going to remove in the transaction |
14 | # is actually there (otherwise Postgres breaks) |
15 | add_index(:trackbacks, :article_id) rescue nil |
16 | modify_tables_and_update([:add_column, BareContent, :blog_name, :string], |
17 | [:remove_index, BareTrackback, :article_id ]) do |
18 | BareContent.transaction do |
19 | if not $schema_generator |
20 | BareTrackback.find(:all).each do |tb| |
21 | a = BareContent.find(tb.article_id) |
22 | BareContent.create(:type => 'Trackback', |
23 | :article_id => tb.article_id, |
24 | :blog_name => tb.blog_name, |
25 | :title => tb.title, |
26 | :excerpt => tb.excerpt, |
27 | :url => tb.url, |
28 | :ip => tb.ip, |
29 | :created_at => tb.created_at, |
30 | :updated_at => tb.updated_at, |
31 | :guid => tb.guid) |
32 | end |
33 | end |
34 | end |
35 | end |
36 | drop_table :trackbacks |
37 | end |
38 | |
39 | def self.transactions_init(t) |
40 | t.column :article_id, :integer |
41 | t.column :blog_name, :string |
42 | t.column :title, :string |
43 | t.column :excerpt, :string |
44 | t.column :url, :string |
45 | t.column :ip, :string |
46 | t.column :created_at, :datetime |
47 | t.column :updated_at, :datetime |
48 | t.column :guid, :string |
49 | end |
50 | |
51 | def self.down |
52 | STDOUT.puts "Recreating Trackbacks from Contents table" |
53 | modify_tables_and_update([:create_table, :trackbacks, lambda {|t| transactions_init(t)}], |
54 | [:add_index, :trackbacks, :article_id]) do |
55 | BareContent.transaction do |
56 | BareContent.find(:all, :conditions => ["type = ?", 'Trackback']).each do |tb| |
57 | BareTrackback.create(:article_id => tb.article_id, |
58 | :blog_name => tb.blog_name, |
59 | :title => tb.title, |
60 | :excerpt => tb.excerpt, |
61 | :url => tb.url, |
62 | :ip => tb.ip, |
63 | :created_at => tb.created_at, |
64 | :updated_at => tb.updated_at, |
65 | :guid => tb.guid) |
66 | end |
67 | BareContent.delete_all("type = 'Trackback'") |
68 | end |
69 | end |
70 | remove_column :contents, :blog_name |
71 | end |
72 | end |