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:
- 1492 Bytes
1 | class Bare38Blog < ActiveRecord::Base |
2 | include BareMigration |
3 | end |
4 | |
5 | class Bare38Setting < ActiveRecord::Base |
6 | include BareMigration |
7 | end |
8 | |
9 | class AddBlogObject < ActiveRecord::Migration |
10 | def self.up |
11 | begin |
12 | STDERR.puts "Adding a blogs table" |
13 | create_table :blogs do |t| |
14 | t.column :dummy, :string unless $schema_generator |
15 | end |
16 | unless $schema_generator |
17 | Bare38Blog.reset_column_information |
18 | |
19 | add_column :settings, :blog_id, :integer |
20 | Bare38Setting.reset_column_information |
21 | |
22 | Bare38Setting.transaction do |
23 | STDERR.puts "Creating default blog" |
24 | default_blog = Bare38Blog.create! |
25 | |
26 | STDERR.puts "Connecting settings to the default blog" |
27 | |
28 | STDERR.puts "New Default blog has id: " + default_blog.id.to_s |
29 | STDERR.puts "Migrating #{Bare38Setting.find(:all).size} settings to the new Blog" |
30 | |
31 | Bare38Setting.find(:all).each do |setting| |
32 | setting.blog_id = default_blog.id |
33 | setting.save! |
34 | end |
35 | end |
36 | remove_column :blogs, :dummy |
37 | end |
38 | rescue Exception => e |
39 | STDERR.puts("Rolling back the changes") |
40 | drop_table(:blogs) rescue nil |
41 | remove_column(:settings, :blog_id) rescue nil |
42 | raise e |
43 | end |
44 | end |
45 | |
46 | def self.down |
47 | STDERR.puts "Unlinking settings and removing the blogs table" |
48 | Bare38Setting.delete_all(["blog_id != ?", Bare38Blog.find(:first)]) |
49 | remove_column :settings, :blog_id |
50 | drop_table :blogs |
51 | end |
52 | end |