Nick, Well, you're right, the interval would depend on how old the application is. I'd rather do this through the ORM so that I can check each field to see if it's the appropriate type (DateTimeField), since I don't know exactly which fields I'll be working on (I know, it's pretty ridiculous). I have to check the field type and increment if it's a date field.
-- Joey "JoeLinux" Espinosa Python Developer http://about.me/joelinux On Apr 12, 2013 7:04 PM, "Nick D" <dominguez.nicho...@gmail.com> wrote: > Joe, > > I'm new to Django but I do have some SQL experience. Couldn't you just run > a statement similar to the following? > > update mytable > set date1 = DATE_ADD(date1, INTERVAL 1 DAY) > > The pinch point here is the fact that you would have to update the > interval based on how old the application is. That doesn't sound like fun! > Can you give me a better idea of your data structure? > > On Friday, April 12, 2013 12:00:09 PM UTC-7, JoeLinux wrote: > >> Hey guys, >> >> I have a situation where I have test data that has been entered into a >> demo database (MySQL). During the demo of the app with a customer, data >> will be altered. After the demo is complete, I need to "reset" the demo >> data back to what it was before the demo. >> >> I realize I could do this easily by dumping the database and then >> restoring it after the demo is complete, but there's a catch... *the >> dates all need to change, too.* >> >> So, say the demo happens on 05/01. I have an "Event" object with a date >> of "05/22" (21 days in the future). When the demo gets reset (I'm planning >> on a nightly reset, maybe 2am or something), it needs to change ALL the >> dates in the database to have the same "timedelta" to the next day. So on >> the next day, 05/02, that same "Event" object would have a date of "05/23" >> (still 21 days in the future). This is necessary to keep things like >> date-based notifications, triggers, and other related things always in the >> same state whenever the demo occurs. >> >> I figure the steps would go something like this: >> 1) Dump database >> 2) // do demo >> 3) Restore database from dump >> 4) Some sort of django management command run on a cronjob to change all >> dates (or maybe straight SQL in a PROCEDURE or something). >> >> Any ideas on how to accomplish this? >> -- >> Joey "JoeLinux" Espinosa* >> * >> <http://therealjoelinux.blogspot.com><http://twitter.com/therealjoelinux><http://about.me/joelinux> >> > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to django-users+unsubscr...@googlegroups.com. > To post to this group, send email to django-users@googlegroups.com. > Visit this group at http://groups.google.com/group/django-users?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.