Sha256: 8f2b7fe96e564b10b873653dc1ff3b96bdb01dab849a995183a2ee9dc3fe257c
Contents?: true
Size: 863 Bytes
Versions: 47
Compression:
Stored size: 863 Bytes
Contents
class CreateBacklogs < ActiveRecord::Migration def self.up create_table :backlogs do |table| table.column :name, :string, :limit => 32, :null => false end tasks_exist = Task.count > 0 if tasks_exist default_backlog = Backlog.create! :name => 'Default Backlog' add_column :tasks, :backlog_id, :integer, :null => false, :default => default_backlog.id # TODO(uwe): This line is only needed because Rails 1.2 cannot set default to NULL change_column_default :tasks, :backlog_id, 0 change_column_default :tasks, :backlog_id, nil else add_column :tasks, :backlog_id, :integer, :null => false end end def self.down remove_column :tasks, :backlog_id drop_table :backlogs end class Task < ActiveRecord::Base end class Backlog < ActiveRecord::Base end end
Version data entries
47 entries across 47 versions & 1 rubygems