Pro Yearly is on sale from $80 to $50! »

Tracking database changes using Ruby, YAML, and Git - Paul Grayson

B044a0f039af800f4df09bf3b2465f18?s=47 Las Vegas Ruby Group
January 15, 2014
31

Tracking database changes using Ruby, YAML, and Git - Paul Grayson

B044a0f039af800f4df09bf3b2465f18?s=128

Las Vegas Ruby Group

January 15, 2014
Tweet

Transcript

  1. Tracking database changes using Ruby, YAML, and Git Paul Grayson

    Las Vegas Ruby User Group 2014-01-15
  2. Say you have a nice database... Student • id •

    name • description • department_id Department • id • name ...then someone requests version history.
  3. To use Git, export text files • CSV, JSON, XML

    - unreadable, long lines diff --git a/paul.txt b/paul.txt index b9ce041..311b84c 100644 --- a/paul.txt +++ b/paul.txt @@ -1,2 +1,2 @@ -{"id":1,"name":"Paul Grayson","description":"Hello, my name is Paul Grayson, and this is my personal page on the web. I am one of the founders of Pololu, a manufacturer and online retailer of educational/hobby electronics and robotics products located in Las Vegas, Nevada.\n\nI grew up in Urbana, Illinois.","department_id":8} +i{"id":1,"name":"Paul Grayson","description":"Hello, my name is Paul, and this is my personal page on the web. I am one of the founders of Pololu, a manufacturer and online retailer of educational/hobby electronics and robotics products located in Las Vegas, Nevada.\n\nI grew up in Urbana, Illinois.","department_id":8}
  4. Using YAML for export --- id: 1 name: Paul Grayson

    description: |- Hello, my name is Paul Grayson, and this is my personal page on the web. I am one of the founders of Pololu, a manufacturer and online retailer of educational/hobby electronics and robotics products located in Las Vegas, Nevada. I grew up in Urbana, Illinois. department_id: 8 Still uses long lines (Rails default #to_yaml)
  5. YAML + word wrap id: 1 name: Paul Grayson description:

    | Hello, my name is Paul Grayson, and this is my␣ personal page on the web. I am one of the␣ founders of Pololu, a manufacturer and online␣ retailer of educational/hobby electronics and␣ robotics products located in Las Vegas, Nevada. I grew up in Urbana, Illinois. department_id: 8 Wrapped lines (format=flowed) This is uninformative
  6. YAML + word wrap, recursive id: 1 name: Paul Grayson

    description: | Hello, my name is Paul Grayson, and this is my␣ personal page on the web. I am one of the␣ founders of Pololu, a manufacturer and online␣ retailer of educational/hobby electronics and␣ robotics products located in Las Vegas, Nevada. I grew up in Urbana, Illinois. department: id: 8 name: Physics
  7. Ruby implementation class StudentTracker < Tracker track :id track :name

    track :description track(:department) do |person| DepartmentTracker.new(person.department) end end class DepartmentTracker < Tracker track :id track :name end
  8. Further issues • File names / directory structure • When

    to commit? • Push to DB