Database thinkin'...
Jun. 15th, 2008 09:24 pmThere are two programs that run most of my story website. They're uncreatively named storyengine and narrator. Storyengine takes source code from a collection of series (right now these are: The Journal Entries, Aimee, Bloody Beth, and Other Tales) and ball them up into an archive ready to be deployed to the web. My stories start as plain text in my Documents folder (unlike Windows weenies, we Linux men and women rarely prefix our directories with that narcissistic and infantile "we"), in the "plain text" flavor of the day: I started out in a Usenet-flavored syntax, morphed into AFT (Almost Free Text), and now use Emacs-Muse for most of my writing. Muse is well-supported and easy to understand, and it has the four basic faces I need: blockquote, italics, boldface, and texttype. When I'm ready to add a story to the database, I run it through a small python program called etxttoxml which converts my scribblings into an XML document and gives it a header that looks like this:
The rest of the document is elided. It's HTML. Some of these fields aren't used, like commentid, which was meant at the time to link to a forum database entry for that story in specific. I doubt I'll ever get the kind of readership that XKCD gets so I've never implemented the forum. Pubdate is the number of days (not seconds) since January 1st, 1970.
So, right now the bulk of the database is "stories," with "arcs" and "series" as the heavy metadata. Series have stories, and some stories belong to arcs.
I'm starting to think I need a rails program just to keep track of what the heck is going on in my stories database. I should be able to whip one up in a couple of hours, ne?
[A couple of hours later...] I am defeated. Rails 2.0 is way different from 1.2. So way different I can't even begin to figure out where the heck to go. You don't build controllers anymore; instead, you kind of summon them with a complete model and the migration in place, and no real power to adjust anything at first. It kinda sucks. I understand that it's a better model, David, but could we please have some documentation with it?
Anyway, at least it's coming along...
<story> <meta> <title>Nymphs In November</title> <commentid></commentid> <pubdate>13911</pubdate> <wordcount>7541</wordcount> <cookie>XX</cookie> <arc>The Mystical Treefort</arc> <summary>Jack and Annie go to Sicily to meet Sappho</summary> <wikipage>n/a</wikipage> <storycodes>n/a</storycodes> </meta> <body>
The rest of the document is elided. It's HTML. Some of these fields aren't used, like commentid, which was meant at the time to link to a forum database entry for that story in specific. I doubt I'll ever get the kind of readership that XKCD gets so I've never implemented the forum. Pubdate is the number of days (not seconds) since January 1st, 1970.
So, right now the bulk of the database is "stories," with "arcs" and "series" as the heavy metadata. Series have stories, and some stories belong to arcs.
I'm starting to think I need a rails program just to keep track of what the heck is going on in my stories database. I should be able to whip one up in a couple of hours, ne?
[A couple of hours later...] I am defeated. Rails 2.0 is way different from 1.2. So way different I can't even begin to figure out where the heck to go. You don't build controllers anymore; instead, you kind of summon them with a complete model and the migration in place, and no real power to adjust anything at first. It kinda sucks. I understand that it's a better model, David, but could we please have some documentation with it?
Anyway, at least it's coming along...
