Files
redux-scraper/db/migrate/20250723193659_migrate_e621_posts_to_aux.rb
2025-07-24 15:44:50 +00:00

59 lines
1.7 KiB
Ruby

# typed: strict
# frozen_string_literal: true
#
class MigrateE621PostsToAux < ActiveRecord::Migration[7.2]
sig { void }
def change
create_aux_table :domain_posts, :e621 do |t|
t =
T.cast(t, ActiveRecord::ConnectionAdapters::PostgreSQL::TableDefinition)
t.string :state, null: false
t.integer :e621_id, null: false
t.timestamp :scanned_post_favs_at
t.string :rating
t.jsonb :tags_array
t.jsonb :flags_array
t.jsonb :pools_array
t.jsonb :sources_array
t.jsonb :artists_array
t.timestamp :e621_updated_at
t.integer :parent_post_e621_id
t.references :last_index_page,
index: false,
foreign_key: {
to_table: :http_log_entries,
}
t.references :caused_by_entry,
index: false,
foreign_key: {
to_table: :http_log_entries,
}
t.references :scan_log_entry,
index: false,
foreign_key: {
to_table: :http_log_entries,
}
t.jsonb :index_page_ids
t.string :description
t.integer :score
t.integer :score_up
t.integer :score_down
t.integer :num_favorites
t.integer :num_comments
t.integer :change_seq
t.string :md5
t.jsonb :prev_md5s
t.string :scan_error
t.references :uploader_user,
index: false,
foreign_key: {
to_table: :domain_users_e621_aux,
primary_key: :base_table_id,
}
end
end
end