Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #3906 - Fix migration script in order to migration eventlogs from version 1 #116

Merged
merged 1 commit into from Sep 17, 2013
Merged

Fixes #3906 - Fix migration script in order to migration eventlogs from version 1 #116

merged 1 commit into from Sep 17, 2013

Conversation

nperron
Copy link
Contributor

@nperron nperron commented Sep 5, 2013

Fixes #3906 - Fix migration script in order to migration eventlogs from version 1
Ref http://www.rudder-project.org/redmine/issues/3906

@jooooooon
Copy link
Member

This makes sense to me, and looks valid from a shell scripting point of view, but I don't understand the logic behind it. I'd rather @fanf did the Technical Review.

@fanf
Copy link
Member

fanf commented Sep 6, 2013

The logic is ok: we want to find the lowest "fileformat" and set it in the migration column in our database.
But it seems to reapeat itself A LOT:

  • all request are the same modulo the fileformat number;
  • content of the different migration files are the same modulo the number setted in the column
  • for each new fileformat added, then a new variable+elif+same sql file has to be created.

Can't we do something like
FILEFORMAT=""
for i in 2 1 do
RES=$(su - postgres -c "psql -t -d rudder -c "select count() from (select xpath('/entry/[@fileformat=${FILEFORMAT}]',data) AS x from eventlog) as Y where array_upper(x, 1) > 0;"")
if [ $RES -ne 0 ]; then FILEFORMAT=$RES; fi
done

And then give the result of FILEFORMAT as input for the SQL update script (if non empty) ?

@nperron
Copy link
Contributor Author

nperron commented Sep 17, 2013

Pull Request updated

@fanf
Copy link
Member

fanf commented Sep 17, 2013

Seems good! Thanks

fanf added a commit that referenced this pull request Sep 17, 2013
…o_permit_migration_from_v1

Fixes #3906 - Fix migration script in order to migration eventlogs from version 1
@fanf fanf merged commit 2ee83c8 into Normation:branches/rudder/2.4 Sep 17, 2013
@nperron nperron deleted the bug_3906/int/fix_eventlog_flag_to_permit_migration_from_v1 branch September 17, 2013 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants