Sha256: c293607fa79740887462e8f4c2f8c8a553f7d229179433b65c3e960db84166fb

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

require "jobshop/helpers/migration.rb"

class CreateThings < ActiveRecord::Migration[5.1]
  include Jobshop::Helpers::Migration

  def change
    create_table :jobshop_things, id: false do |t|
      t.uuid :organization_id, null: false
      t.uuid :thing_id, null: false, default: "gen_random_uuid()"
      t.index [ :organization_id, :thing_id ],
        name: :idx_jobshop_things_pkey, unique: true

      t.uuid :collection_id, null: false
      t.citext :name
      t.index [ :organization_id, :collection_id, :name ], unique: true,
        name: :idx_jobshop_organization_id_collection_id_name

      t.jsonb :custom_fields, null: false, default: "{}"
      t.index :custom_fields, using: :gin

      t.timestamps
    end

    idx_table_name_pkey "jobshop_things"
    fk_organization_id "jobshop_things"

    create_table :jobshop_collections, id: false do |t|
      t.uuid :organization_id, null: false
      t.uuid :collection_id, null: false, default: "gen_random_uuid()"
      t.index [ :organization_id, :collection_id ], unique: true,
        name: :idx_jobshop_collections_pkey

      t.citext :name
      t.index [ :organization_id, :name ], unique: true

      t.jsonb :schema, null: false, default: "{}"

      t.timestamps
    end

    idx_table_name_pkey "jobshop_collections"
    fk_organization_id "jobshop_collections"
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jobshop-0.0.157 db/migrate/20171216035357_create_things.rb