Re: TDD Database migration code
"Adam Sroka [email protected] [testdrivendevelopment]" <[email protected]> Wed, 20 Apr 2016 00:21:33 -0700
| Newsgroups | gmane.comp.programming.test-driven-development |
|---|---|
| Message-ID | <CALaPUVe=Fz=N-9cdTM9iHTHTAPJq82ZNXH0==BJ1n6oDRs123g@mail.gmail.com> |
Are you talking about test driving database access code from a general purpose language? Or are you talking about test driving stuff inside the database engine? There is http://pgtap.org/ but I would look for a way to do it at a higher level, unless... a gun was pointed at my head. On Tuesday, April 19, 2016, [email protected] [testdrivendevelopment] < [email protected]> wrote: > > > My google searches are giving me bad results... :( > > Does anyone know of any good articles, or have any good hints, on how to > do TDD for writing PostgresSQL, or database code? > > I need to write a custom system which allows us to do DB migrations and > updates etc, a bit similar to what Ruby on Rails with has their DB > rake:migration command.* > > Google is mostly giving me information on how to abstract out DB objects, > but I need to verify that my new custom migration system is actually > working. > > The tests I would want to write are simples > 1. Confirm that a migration file worked (say by adding a column) > 2. Confirm that only the latest migration was run, and not a previous > one (say by checking a value in the table wasn't changed) > > I appreciate the help you can provide. > > *The short version is: > 1. A command which generates a .sql file with a timestamp in the file > name. > 2. A command which checks all the files in a folder, and then does some > comparisons to another db, and picks one or more .sql files to run on the > db in question. > > > > > > >