Sha256: 56d852a3c5871f9c4e894846042c6eeddb87f3b76375a6ca88cb394b4ffcb735

Contents?: true

Size: 1.35 KB

Versions: 10

Compression:

Stored size: 1.35 KB

Contents

class AddDockerImageFields < ActiveRecord::Migration
  def up
    add_column :docker_images, :katello_uuid, :string
    add_column :docker_images, :katello_repository_id, :integer
    add_column :docker_tags, :katello_repository_id, :integer

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

    add_index :docker_images, :katello_uuid, :unique => true

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

    add_index :docker_tags, [:docker_image_id, :katello_repository_id, :tag],
              :name => :katello_repo_docker_tags_image_repo_id, :unique => true

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

    add_foreign_key :docker_tags, :katello_repositories,
                    :column => :katello_repository_id
  end

  def down
    remove_column :docker_images, :katello_uuid
    remove_column :docker_images, :katello_repository_id
    remove_column :docker_tags, :katello_repository_id
    drop_table :katello_repository_docker_images
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
katello-2.4.5 db/migrate/20141015173220_add_docker_image_fields.rb
katello-2.4.4 db/migrate/20141015173220_add_docker_image_fields.rb
katello-2.4.3 db/migrate/20141015173220_add_docker_image_fields.rb
katello-2.4.2 db/migrate/20141015173220_add_docker_image_fields.rb
katello-2.4.1 db/migrate/20141015173220_add_docker_image_fields.rb
katello-2.4.0 db/migrate/20141015173220_add_docker_image_fields.rb
katello-2.4.0.rc3 db/migrate/20141015173220_add_docker_image_fields.rb
katello-2.4.0.rc2 db/migrate/20141015173220_add_docker_image_fields.rb
katello-2.4.0.rc1 db/migrate/20141015173220_add_docker_image_fields.rb
katello-2.2.2 db/migrate/20141015173220_add_docker_image_fields.rb