Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
limbra
limbra
Commits
6df8af54
Commit
6df8af54
authored
Oct 18, 2015
by
LE GAC Renaud
Browse files
Delete obsolete script mv_dbschema_0815.
parent
c1d69d4c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
80 deletions
+0
-80
scripts/mv_dbschema_0815
scripts/mv_dbschema_0815
+0
-80
No files found.
scripts/mv_dbschema_0815
deleted
100755 → 0
View file @
c1d69d4c
#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" NAME
mv_dbschema_0815
SYNOPSIS
Modify the database schema for all existing database.
DESCRIPTION
In the release 0.8.15, the database schema evolved.
* Add the field synonyms in collaboration, countries
and publishers
* Remove the obsolete table application.
* Remove the obsolete field harvesters.ratio
The script scan on all the database defined in models
and modify the database.
OPTIONS
-h, --help
Display the help and exit.
EXAMPLE
> cd ...track_publications/scripts
> ./mb_dbschema_0815.py ../models/_dev_pro.py
AUTHOR
R. Le Gac -- Oct 2015
"""
if
__name__
==
'__main__'
:
import
argparse
import
os
import
re
import
subprocess
import
sys
REG_MYSQL
=
re
.
compile
(
r
"mysql://(\w+):(\w+)@([\w\.]+)/(\w+)"
)
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"path"
,
help
=
"path to the configuration file containing the DBURIS."
)
ARGS
=
parser
.
parse_args
()
#
# Get the DBURIS
#
execfile
(
ARGS
.
path
)
#
# iterate on the databases
#
for
name
,
value
in
DBURIS
.
iteritems
():
rep
=
raw_input
(
'
\n
Modify the database "%s" [y/N]: '
%
name
)
if
rep
!=
"y"
:
continue
match
=
REG_MYSQL
.
match
(
value
)
if
not
match
:
print
"Can't decode the URIs !!!"
continue
cmd
=
[
"/usr/bin/mysql"
,
"-u"
,
match
.
group
(
1
),
"-p%s"
%
match
.
group
(
2
),
"-h"
,
match
.
group
(
3
),
match
.
group
(
4
),
"< dbschema-0815.sql"
]
ret
=
subprocess
.
call
(
" "
.
join
(
cmd
),
shell
=
True
)
if
ret
==
0
:
print
"database schema modified."
# exit gently
sys
.
exit
(
0
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment