Sha256: 9768439649b93c06f5b9e74a0a90b26ffdfd7736ac2563c753cfe0799f60087a

Contents?: true

Size: 1.54 KB

Versions: 35

Compression:

Stored size: 1.54 KB

Contents

class RemoveDockerImageSchema < ActiveRecord::Migration
  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

35 entries across 35 versions & 1 rubygems

Version Path
katello-3.5.2 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.5.1.1 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.5.1 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.5.0.1 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.5.0 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.5.0.rc2 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.5.0.rc1 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.4.5 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.4.4 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.4.2 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.4.1 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.4.0.2 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.4.0.1 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.3.2 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.4.0 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.4.0.rc2 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.4.0.rc1 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.3.1.1 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.3.1 db/migrate/20160203195736_remove_docker_image_schema.rb
katello-3.3.0.1 db/migrate/20160203195736_remove_docker_image_schema.rb