Revision 2e291eb2
Added by Ohad Levy about 12 years ago
- ID 2e291eb23bd496947e6704a5aa7a51b03489f651
db/migrate/20090717025820_create_media.rb | ||
---|---|---|
class CreateMedia < ActiveRecord::Migration
|
||
class Medium < ActiveRecord::Base; end
|
||
def self.up
|
||
create_table :media do |t|
|
||
t.string :name, :limit => 50, :default => "", :null => false
|
db/migrate/20090730152224_create_ptables.rb | ||
---|---|---|
class CreatePtables < ActiveRecord::Migration
|
||
class Ptable < ActiveRecord::Base; end
|
||
def self.up
|
||
create_table :ptables do |t|
|
||
t.string :name, :limit => 64, :null => false
|
||
... | ... | |
t.references :operatingsystem, :null => false
|
||
end
|
||
|
||
|
||
end
|
||
|
||
def self.down
|
db/migrate/20100310080727_add_family_to_os.rb | ||
---|---|---|
class AddFamilyToOs < ActiveRecord::Migration
|
||
|
||
class Operatingsystem < ActiveRecord::Base; end
|
||
|
||
def self.up
|
||
add_column :operatingsystems, :family_id, :integer
|
||
|
db/migrate/20100414125652_add_releasename_to_os.rb | ||
---|---|---|
class AddReleasenameToOs < ActiveRecord::Migration
|
||
|
||
class Operatingsystem < ActiveRecord::Base; end
|
||
|
||
def self.up
|
||
add_column :operatingsystems, :release_name, :string, :limit => 64
|
||
|
db/migrate/20100523141204_create_media_operatingsystems_and_migrate_data.rb | ||
---|---|---|
class CreateMediaOperatingsystemsAndMigrateData < ActiveRecord::Migration
|
||
|
||
class Medium < ActiveRecord::Base; end
|
||
|
||
def self.up
|
||
|
||
medium_hash = Hash.new
|
db/migrate/20100601221000_update_os_minor.rb | ||
---|---|---|
class UpdateOsMinor < ActiveRecord::Migration
|
||
|
||
class Operatingsystem < ActiveRecord::Base; end
|
||
|
||
def self.up
|
||
Operatingsystem.update_all("minor = ''", {:minor => nil})
|
||
change_column :operatingsystems, :minor, :string, :limit => 16, :default => "", :null => false
|
db/migrate/20100616114400_change_family_in_os.rb | ||
---|---|---|
class ChangeFamilyInOs < ActiveRecord::Migration
|
||
|
||
class Operatingsystem < ActiveRecord::Base; end
|
||
|
||
def self.up
|
||
add_column :operatingsystems, :type, :string, :limit => 16
|
||
add_index :operatingsystems, :type
|
||
|
||
Operatingsystem.reset_column_information
|
||
|
||
families = Operatingsystem.families
|
||
families = ["Debian", "Redhat", "Solaris", "Suse", "Windows"]
|
||
|
||
ok = true
|
||
for os in Operatingsystem.all
|
||
Operatingsystem.all.each do |os|
|
||
if os.family_id
|
||
say "Converting #{os.family_id} into #{families[os.family_id]}"
|
||
os.update_attribute :type, families[os.family_id]
|
db/migrate/20110213104226_create_proxy_features.rb | ||
---|---|---|
class CreateProxyFeatures < ActiveRecord::Migration
|
||
|
||
class Feature < ActiveRecord::Base; end
|
||
|
||
def self.up
|
||
# Create the tables
|
||
create_table :features do |t|
|
Also available in: Unified diff
fixes #1568 - PG::Error on fresh install