Sha256: 12783447e9b92e7538e9a10c9cc7586931b7c340b33f5c4b9f84029a80171923
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
class CreateActivityTable < ActiveRecord::Migration def table_name :restpack_activity_activities end def up create_table table_name do |t| t.integer :application_id t.integer :user_id t.string :title t.text :content t.text :tag_list, :array => true, :default => [] t.decimal :latitude, precision: 10, scale: 6, null: true t.decimal :longitude, precision: 10, scale: 6, null: true t.column :search_vector, 'tsvector' t.json :data t.timestamps end execute "CREATE INDEX #{table_name}_tag_list_index ON #{table_name} USING gin(tag_list)" execute "CREATE INDEX #{table_name}_search_index ON #{table_name} USING gin(search_vector)" execute "CREATE TRIGGER #{table_name}_vector_update BEFORE INSERT OR UPDATE ON #{table_name} FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger(search_vector, 'pg_catalog.english', title, content);" end def down execute "DROP INDEX #{table_name}_tag_list_index" execute "DROP INDEX #{table_name}_search_index" drop_table table_name end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
restpack_activity_service-0.0.13 | db/migrate/20130630145409_create_activity_table.rb |