Sha256: 7295e1f73d49210c9ddfd0abe213383ff3d10e774f7b519249ff1b228a488e24

Contents?: true

Size: 1.37 KB

Versions: 44

Compression:

Stored size: 1.37 KB

Contents

class AddDockerImageFields < ActiveRecord::Migration
  def up
    add_column :docker_images, :katello_uuid, :string, :limit => 255
    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

44 entries across 44 versions & 1 rubygems

Version Path
katello-3.0.0.rc4 db/migrate/20141015173220_add_docker_image_fields.rb
katello-3.0.0.rc3 db/migrate/20141015173220_add_docker_image_fields.rb
katello-3.0.0.rc2 db/migrate/20141015173220_add_docker_image_fields.rb
katello-3.0.0.rc1 db/migrate/20141015173220_add_docker_image_fields.rb