* Add podcast_appearances joined table (forem#82) * Add podcast appearances keys unique constraint and creator property (forem#82) * Add podcast_appearance role validation forem(#82) * Add spec test for podcast_appearances model (forem#82) * Small refactoring - place podcast appearance association by alphabetical order * Adapt m2m association to pass rspec test (forem#82) * Rename podcast appearance model to podcast episode appearance and remove fk indexing * Rename podcast appearance model to podcast episode appearance and remove fk indexing * Rename podcast episode appearance models and spec models. Update podcast episode and user spec tests (forem#82) * Rename podcast episode appearances composite index to follow Rails naming pattern (forem#82) * Remove ddl_transaction disabling and conurrent index adding from appearance migration * Add role validation in model spec (forem#82)
16 lines
707 B
Ruby
16 lines
707 B
Ruby
class CreatePodcastEpisodeAppearances < ActiveRecord::Migration[6.0]
|
|
def change
|
|
create_table :podcast_episode_appearances do |t|
|
|
t.references :user, null: false, foreign_key: true, index: false
|
|
t.references :podcast_episode, null: false, foreign_key: true, index: false
|
|
t.string :role, null: false, default: "guest"
|
|
t.boolean :approved, null: false, default: false
|
|
t.boolean :featured_on_user_profile, null: false, default: false
|
|
t.timestamps
|
|
end
|
|
add_index :podcast_episode_appearances,
|
|
%i[podcast_episode_id user_id],
|
|
unique: true,
|
|
name: "index_pod_episode_appearances_on_podcast_episode_id_and_user_id"
|
|
end
|
|
end
|