Sha256: 9280ecdcb18a738ab86369d431d02eb605432af2bd55e9976260a23277d70923
Contents?: true
Size: 992 Bytes
Versions: 2
Compression:
Stored size: 992 Bytes
Contents
class <%= @migration_class_name %> < ActiveRecord::Migration[<%= ActiveRecord::Migration.current_version %>] def self.up enable_extension 'pgcrypto' unless extensions.include?('pgcrypto') create_table :stores, id: :uuid do |t| t.string :name t.text :description t.jsonb :data, default: {} t.decimal :value, precision: 15, scale: 2 t.jsonb :schema, default: {} t.jsonb :tags, default: {} t.timestamps end create_table :owners, id: :uuid do |t| t.string :name t.text :description t.jsonb :tags, default: {} t.timestamps end create_join_table :stores, :owners, column_options: { type: :uuid } do |t| t.index %I[store_id owner_id] t.index %I[owner_id store_id] end add_index :stores, :tags, using: :gin add_index :owners, :tags, using: :gin end def self.down drop_table :owners_stores drop_table :owners drop_table :stores end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
hws-stores-0.1.1 | lib/generators/hws/stores/templates/migration.rb.erb |
hws-stores-0.1.0 | lib/generators/hws/stores/templates/migration.rb.erb |