Websites/db/migrate/20231114133133_create_short_urls.rb

19 lines
584 B
Ruby
Raw Normal View History

2024-05-03 03:04:43 +00:00
# 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