Sha256: 9d7f80d9323baa11802c3b96019c082c7d50156a36d99cd81711a1df89d7c2cc

Contents?: true

Size: 1.02 KB

Versions: 8

Compression:

Stored size: 1.02 KB

Contents

class CreateDockerImages < ActiveRecord::Migration
  def up
    create_table :docker_images do |t|
      t.string  :image_id
      t.integer :size
      t.timestamps
    end

    create_table :docker_tags do |t|
      t.string :tag
      t.references :docker_image, :null => false
      t.timestamps
    end
    add_foreign_key :docker_tags, :docker_images,
                    :column => :docker_image_id

    remove_column :containers, :image
    remove_column :containers, :tag
    add_column :containers, :docker_image_id, :integer
    add_column :containers, :docker_tag_id, :integer
    add_foreign_key :containers, :docker_images,
                    :column => :docker_image_id
    add_foreign_key :containers, :docker_tags,
                    :column => :docker_tag_id
  end

  def down
    drop_table :docker_images
    drop_table :docker_tags

    add_column :containers, :image, :string
    add_column :containers, :tag, :string
    remove_column :containers, :docker_image_id
    remove_column :containers, :docker_tag_id
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
foreman_docker-3.2.1 db/migrate/20141010173220_create_docker_images.rb
foreman_docker-3.2.0 db/migrate/20141010173220_create_docker_images.rb
foreman_docker-3.1.0 db/migrate/20141010173220_create_docker_images.rb
foreman_docker-3.0.0 db/migrate/20141010173220_create_docker_images.rb
foreman_docker-2.1.1 db/migrate/20141010173220_create_docker_images.rb
foreman_docker-2.1.0 db/migrate/20141010173220_create_docker_images.rb
foreman_docker-2.0.1 db/migrate/20141010173220_create_docker_images.rb
foreman_docker-2.0.0 db/migrate/20141010173220_create_docker_images.rb