You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
alphadex/scripts/20231111_archive_pinboard.rb

16 lines
405 B

require "json"
require_relative "../db"
entities = DB[:entities]
pinboard = DB[:pinboard]
path = File.expand_path("~/Downloads/pinboard_export.2023.11.11_23.05.json_nd")
File.foreach(path).with_index do |line, i|
created_at = modified_at = DateTime.now
json = line.chomp
entity_id = entities.insert(created_at:, modified_at:)
pinboard.insert(entity_id:, json: , created_at:, modified_at:)
end