Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
ensembl
Commits
9ae0c42f
Commit
9ae0c42f
authored
18 years ago
by
Glenn Proctor
Browse files
Options
Downloads
Patches
Plain Diff
Added option to force overwrite of database (only required in extreme circumstances!)
parent
c3d2fbd4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
misc-scripts/external_db/update_external_dbs.pl
+13
-5
13 additions, 5 deletions
misc-scripts/external_db/update_external_dbs.pl
with
13 additions
and
5 deletions
misc-scripts/external_db/update_external_dbs.pl
+
13
−
5
View file @
9ae0c42f
...
...
@@ -9,7 +9,7 @@ use Getopt::Long;
use
DBI
;
use
IO::
File
;
my
(
$host
,
$user
,
$pass
,
$port
,
@dbnames
,
$file
,
$release_num
,
$master
);
my
(
$host
,
$user
,
$pass
,
$port
,
@dbnames
,
$file
,
$release_num
,
$master
,
$force
);
GetOptions
(
"
host=s
",
\
$host
,
"
user=s
",
\
$user
,
...
...
@@ -18,7 +18,8 @@ GetOptions( "host=s", \$host,
"
file=s
",
\
$file
,
"
dbnames=s@
",
\
@dbnames
,
"
release_num=i
",
\
$release_num
,
"
master=s
",
\
$master
"
master=s
",
\
$master
,
"
force
",
\
$force
);
#both host and file are required
...
...
@@ -92,7 +93,12 @@ foreach my $dbname (@dbnames) {
print
STDERR
"
Looking at
$dbname
...
\n
";
if
(
compare_external_db
(
$db
,
$master
,
$dbname
))
{
if
(
$force
)
{
print
STDERR
"
Forcing overwrite of external_db table in
$dbname
from
$file
\n
";
load_database
(
$db
,
$dbname
,
@rows
);
}
elsif
(
compare_external_db
(
$db
,
$master
,
$dbname
))
{
print
STDERR
"
$dbname
has no additional rows. Overwriting external_db table from
$file
\n
";
load_database
(
$db
,
$dbname
,
@rows
);
...
...
@@ -180,6 +186,8 @@ sub usage {
-pass password
-port port_of_server optional
-master the name of the master database to load the file into
-force force update, even if there are rows in the database
that are not in the file
-release the release of the database to update used to
match database names.
e
.
g
.
13
-
file
the
path
of
the
file
containing
the
insert
statements
...
...
@@ -200,8 +208,8 @@ sub usage {
perl
update_external_dbs
.
pl
-
host
ecs2d
-
file
external_dbs
.
txt
-
user
ensadmin
-
pass
secret
-
release
14
If
the
databases
to
be
updated
contain
rows
that
are
not
in
the
file
,
a
warning
will
be
given
and
the
database
in
question
skipped
.
be
given
and
the
database
in
question
skipped
,
unless
-
force
is
used
.
EOF
;
exit
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment