Sha256: 8bdfd7850d2b399d49e4b090e849d35cab0c5622f99b9d70e81f2a9aa2298e02

Contents?: true

Size: 1.42 KB

Versions: 43

Compression:

Stored size: 1.42 KB

Contents

class CreateDockerTables < ActiveRecord::Migration
  def up
    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_docker_tags do |t|
      t.string :name, :limit => 255
      t.integer :docker_image_id
      t.integer :repository_id
      t.timestamps
    end
    add_index :katello_docker_images, :uuid, :unique => true
    add_foreign_key :katello_docker_tags, :katello_docker_images, :column => "docker_image_id"
    add_foreign_key :katello_docker_tags, :katello_repositories, :column => "repository_id"

    add_index :katello_docker_tags, [:docker_image_id, :repository_id, :name],
              :name => :docker_tag_docker_image_repo_name, :unique => true
    unless foreign_key_exists?(:katello_repository_docker_images, :column => :docker_image_id)
      add_foreign_key :katello_repository_docker_images, :katello_docker_images,
                      :column => :docker_image_id
    end
  end

  def down
    remove_foreign_key :katello_repository_docker_images, :name => "katello_repository_docker_images_docker_image_id_fk"
    remove_foreign_key :katello_docker_tags, :name => "katello_docker_tags_docker_image_id_fk"
    remove_foreign_key :katello_docker_tags, :name => "katello_docker_tags_repository_id_fk"
    drop_table :katello_docker_images
    drop_table :katello_docker_tags
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

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