added artists, comments
This commit is contained in:
22
db/migrate/20100214080549_create_artists.rb
Normal file
22
db/migrate/20100214080549_create_artists.rb
Normal file
@@ -0,0 +1,22 @@
|
||||
class CreateArtists < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :artists do |t|
|
||||
t.column :name, :string, :null => false
|
||||
t.column :creator_id, :integer, :null => false
|
||||
t.column :is_active, :boolean, :null => false, :default => true
|
||||
t.column :other_names, :text
|
||||
t.column :other_names_index, "tsvector"
|
||||
t.column :group_name, :string
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :artists, :name, :unique => true
|
||||
add_index :artists, :group_name
|
||||
execute "CREATE INDEX index_artists_on_other_names_index ON artists USING GIN (other_names_index)"
|
||||
execute "CREATE TRIGGER trigger_artists_on_update BEFORE INSERT OR UPDATE ON artists FOR EACH ROW EXECUTE PROCEDURE tsvector_update_trigger('other_names_index', 'public.danbooru', 'other_names')"
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :artists
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user