google-code-export / redmine-dmsf

Automatically exported from code.google.com/p/redmine-dmsf
1 stars 1 forks source link

Migrations modify updated_at field when revisions are saved. #194

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Upgrade plugin such that migration 06_dmsf_1_2_0.rb is required
2. Migrate plugins
3. Observer updated_at for all files is now the time of migration

What is the expected output? What do you see instead?

Updated_at value should not change due to migration.

What version of the DMSF and Redmine are you using? On what browser and
operating system?

Upgraded from DMSF 0.6 to DMSF 1.2.2, running Chiliproject 1.3

Please provide any additional information below.

Migrations that require re-saving DmsfFileRevision entries should disable 
record_timestamps. See the following for a suggested method: 
http://stackoverflow.com/a/4631488/149060

Original issue reported on code.google.com by pauli.pr...@gmail.com on 8 Feb 2012 at 4:37

GoogleCodeExporter commented 9 years ago
s/Observer/Observe/

Original comment by pauli.pr...@gmail.com on 8 Feb 2012 at 4:37

GoogleCodeExporter commented 9 years ago
Pre-migration timestamps were restored, for a mysql database, via the following 
process:

# spinning up new server from the backup image, (or load the pre-migration 
backup of your production database into a server somewhere)

# connect to the pre-migration backup database

# generate update statements with the following query: 

<pre>  select concat("update dmsf_file_revisions set updated_at = '", 
updated_at, "' where id = ",id,";") from dmsf_file_revisions;</pre>

# place this statement in a file, query.sql, and create update file from the 
commandline, like this:

  <pre>mysql -u dbuser -ppasswd db_name < query.sql > updates.sql</pre>

# test update statements in a backup of your post-migration production database

# if testing is ok, run sql update on production:

<pre>  mysql -u dbuser -ppasswd db_name < updates.sql </pre>

Original comment by pauli.pr...@gmail.com on 8 Feb 2012 at 9:28