Sha256: cc7222bd9a10cf3bdf5a822ca49f0b410d187ea4f90b471589d2491b2b373833

Contents?: true

Size: 1.54 KB

Versions: 29

Compression:

Stored size: 1.54 KB

Contents

class RemoveDockerImageSchema < ActiveRecord::Migration[4.2]
  def up
    if foreign_key_exists?(:katello_docker_tags, :name => "katello_docker_tags_docker_image_id_fk")
      remove_foreign_key :katello_docker_tags, :name => "katello_docker_tags_docker_image_id_fk"
    end
    remove_column :katello_docker_tags, :docker_image_id
    drop_table :katello_repository_docker_images
    drop_table :katello_docker_images
  end

  def down
    add_column :katello_docker_tags, :docker_image_id, :integer

    create_table :katello_docker_images do |t|
      t.string :image_id, :limit => 255
      t.integer :size
      t.string :uuid, :limit => 255
      t.timestamps
    end

    create_table :katello_repository_docker_images do |t|
      t.references :docker_image, :null => false
      t.references :repository, :null => true
    end

    add_index :katello_docker_images, :uuid, :unique => true

    add_index :katello_docker_tags, [:docker_image_id, :repository_id, :name],
              :name => :docker_tag_docker_image_repo_name, :unique => true

    add_foreign_key :katello_docker_tags, :katello_docker_images, :column => "docker_image_id"

    add_index :katello_repository_docker_images, [:docker_image_id, :repository_id],
              :name => :katello_repo_docker_imgs_image_repo_id, :unique => true

    add_foreign_key :katello_repository_docker_images, :katello_repositories,
                    :column => :repository_id

    add_foreign_key :katello_repository_docker_images, :katello_docker_images,
                    :column => :docker_image_id
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
katello-3.11.2 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.10.2 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.10.1.1 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.10.1 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.11.1 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.11.0 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.11.0.rc2 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.11.0.rc1 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.10.0 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.10.0.rc1.1 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.9.1 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.10.0.rc1 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.9.0 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.8.1 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.9.0.rc2 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.9.0.rc1 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.7.1.1 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.7.1 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.8.0 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.8.0.rc3 db/migrate/20160203195736_remove_docker_image_schema.rb