This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
class CreatePostTagSections < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
create_table :post_tag_sections, primary_key: [:post_id, :tag_id, :begin_ms] do |t|
|
||||
t.references :post, null: false, foreign_key: true, index: false
|
||||
t.references :tag, null: false, foreign_key: true, index: false
|
||||
t.integer :begin_ms, null: false
|
||||
t.integer :end_ms, null: false
|
||||
t.timestamps
|
||||
|
||||
t.index [:post_id, :begin_ms], name: 'idx_post_tag_sections_post_id_begin_ms'
|
||||
|
||||
t.check_constraint 'begin_ms >= 0',
|
||||
name: 'chk_post_tag_sections_begin_ms_natural'
|
||||
|
||||
t.check_constraint 'begin_ms < end_ms',
|
||||
name: 'chk_post_tag_sections_end_ms_after_begin_ms'
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,9 @@
|
||||
class AddVideoMsToPosts < ActiveRecord::Migration[8.0]
|
||||
def change
|
||||
add_column :posts, :video_ms, :integer
|
||||
add_index :posts, [:video_ms, :id], name: 'idx_posts_video_ms_id'
|
||||
|
||||
add_check_constraint :posts, 'video_ms IS NULL OR video_ms > 0',
|
||||
name: 'chk_posts_video_ms_positive'
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user