19 lines
584 B
Ruby
19 lines
584 B
Ruby
# frozen_string_literal: true
|
|
|
|
class CreateShortUrls < ActiveRecord::Migration[7.1]
|
|
def change
|
|
create_table(:short_urls) do |t|
|
|
t.references(:creator, foreign_key: { to_table: :api_users }, null: false)
|
|
t.references(:api_key)
|
|
t.inet(:creator_ip_addr, null: false)
|
|
t.string(:code, null: false, index: { unique: true })
|
|
t.string(:url, null: false)
|
|
t.integer(:hits, null: false, default: 0)
|
|
t.string(:creator_name, null: false)
|
|
t.string(:creator_ua, null: false)
|
|
t.string(:management_code)
|
|
t.timestamps
|
|
end
|
|
end
|
|
end
|