Skip to main content

Posts

Showing posts with the label database schema

Reading and Perspectives: netCDF and Databases

I've been referred to a lot of indie web blogs of late, and it's paying off quite nicely for me Here's the latest example. Simon Willison--co-creator of Django and creator of Datasette--has a blog that led me to Maggie Appleton's site . Once there, I found a very nice, and very pretty primer on databases . Within the primer was a perspective I'd never seen before. There was an emphais, (certainly not the only emphasis, but an emphasis nonetheless), placed on columns, like so: from " A Shelfish Starter Guide to Databases " I, frankly, had never considered coluimns in any way except, as 'fields' that contributed to rows, and that could have conditions placed on them. A column as a whole entity unto itself? I'd never considered such a thing. A few days later though, while studying the netCDF format used by COSMIC2 missions among projects, I suddenly needed that column perspective, and I had it! netCDF files from COSMIC2 are very much arranged a...

Modifying Migrations

As I continue my study of RubyOnRails using Build Your Own Ruby On Rails Web Applications by Patrick Lenz, I'm including expansions on certain topics that piqued my interest. First, here are a few useful links if you're reading the book too. book web site book errata ruby on rails docs I learned a little bit more about how rake handles automatic migrations today. I suspected that like it's similarly named counterpart rake might determine which migrations to apply based on the last change date of the migration file. I was wrong. I had created a new migration to add a column to one of my models. I ran rake and everything went without a hitch. Then, about two minutes later, I realized that I still needed to add one more column to that particular model. I didn't want to create another migration file for the second new column. "No problem," I reasoned. "I'll just add a new column to my latest migration file." I did this, ran rake, and not...

The Default Debacle

As I continue my study of RubyOnRails using Build Your Own Ruby On Rails Web Applications by Patrick Lenz, I'm including expansions on certain topics that piqued my interest. First, here are a few useful links if you're reading the book too. book web site book errata ruby on rails docs Today I diverged from the examples in the book again and encountered an issue with the word 'default'. It turns out that default is a SQL keyword depending on the context of the expression it is used in. I wanted to store a default value for a record in a table. This is illustrated in the table below: user default actual tom sleep sleep bob awake sleep susy awake awake The table tracks the 'default' or usual state of each user and their current 'actual' state. This seemed simple enough. The add_column call in my migration file had no problem with the column name 'default'. However, when I tried to add items to the table, the column name 'default' ca...

Experiences Using "Build Your Own Ruby On Rails Web Applications"

This is the first of a series of tech posts on this blog. I'm studying RubyOnRails, (RoR), using an excellent book: Build Your Own Ruby On Rails Web Applications . The book is easy to understand and flows well in a narrative fashion with plenty of humor thrown in. As I build my real-world application I'll post notes of interest here. These posts are intended for RubyOnRails beginners or others reading the book. Model class to database table naming: I understood from the book that a model class like 'Story' would be translated into a table name in a migration file of 'story'. What I was not aware of was that a name like 'MyBigStory' will be translated into a table name of 'my_big_story'. rake and rolling back database migrations: First, this feature of RoR is incredible! Essentially it's revision control for database schemas! With a minimum of work, the developer can maintain a framework that allows her to easily move back and forth b...