50 lines
1.4 KiB
Ruby
50 lines
1.4 KiB
Ruby
# typed: true
|
|
class CreateDomainFaUsers < ActiveRecord::Migration[7.0]
|
|
def up
|
|
create_table :domain_fa_users do |t|
|
|
t.string :name, null: false, index: { unique: true }
|
|
t.string :full_name
|
|
t.string :url_name, null: false, index: { unique: true }
|
|
|
|
t.string :artist_type
|
|
t.string :mood
|
|
t.string :profile_html
|
|
|
|
t.integer :num_pageviews
|
|
t.integer :num_submissions
|
|
t.integer :num_comments_recieved
|
|
t.integer :num_comments_given
|
|
t.integer :num_journals
|
|
t.integer :num_favorites
|
|
|
|
t.datetime :scanned_gallery_at
|
|
t.datetime :scanned_page_at
|
|
t.datetime :registered_at
|
|
t.timestamps
|
|
end
|
|
|
|
create_table :domain_fa_user_http_log_entry_joins, force: :cascade do |t|
|
|
t.references :post, null: false
|
|
t.references :entry, null: false
|
|
t.jsonb :metadata
|
|
end
|
|
|
|
add_foreign_key :domain_fa_user_http_log_entry_joins,
|
|
:domain_fa_users,
|
|
column: :post_id,
|
|
validate: true
|
|
add_foreign_key :domain_fa_user_http_log_entry_joins,
|
|
:http_log_entries,
|
|
column: :entry_id,
|
|
validate: true
|
|
add_foreign_key :domain_fa_posts,
|
|
:domain_fa_users,
|
|
column: :creator_id,
|
|
validate: true
|
|
end
|
|
|
|
def down
|
|
raise("boom")
|
|
end
|
|
end
|