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
0bcd02e4
Commit
0bcd02e4
authored
16 years ago
by
Daniel Rios
Browse files
Options
Downloads
Patches
Plain Diff
added option to force overwriting attrib_type table
parent
4ba7c116
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
misc-scripts/attribute_types/upload_attributes.pl
+22
-4
22 additions, 4 deletions
misc-scripts/attribute_types/upload_attributes.pl
with
22 additions
and
4 deletions
misc-scripts/attribute_types/upload_attributes.pl
+
22
−
4
View file @
0bcd02e4
...
...
@@ -14,7 +14,7 @@ use FindBin;
my
(
$host
,
$user
,
$pass
,
$port
,
@dbnames
,
$file
,
$release_num
,
$nobackup
);
$nobackup
,
$forceTableWrite
);
GetOptions
(
"
host=s
",
\
$host
,
"
user=s
",
\
$user
,
...
...
@@ -23,7 +23,8 @@ GetOptions( "host=s", \$host,
"
file=s
",
\
$file
,
"
nobackup
",
\
$nobackup
,
"
dbnames=s@
",
\
@dbnames
,
"
release_num=i
",
\
$release_num
);
"
release_num=i
",
\
$release_num
,
"
force_table_write
",
\
$forceTableWrite
);
$file
||=
$
FindBin::
Bin
.
"
/attrib_type.txt
";
usage
()
if
(
!
$host
);
...
...
@@ -66,6 +67,7 @@ if ( $input ne 'yes' ) {
my
$attribs
=
read_attrib_file
(
$file
);
my
$table_consistent
;
# if any attrib_types are loaded that are different from the file, a
# consistency problem is reported and the upload is not done.
for
my
$database
(
@dbnames
)
{
...
...
@@ -73,7 +75,11 @@ for my $database (@dbnames) {
backup_attribute_types
(
$host
,
$user
,
$pass
,
$port
,
$database
)
if
(
!
$nobackup
);
if
(
check_consistency
(
$attribs
,
$database
,
$db
)
)
{
$table_consistent
=
check_consistency
(
$attribs
,
$database
,
$db
);
#this has been introduced in e54: when we are sure that the data in the file is consistent
#(e.g. some attributes have been removed from the file since they are not longer are needed)
#you should force the writing option
if
(
$table_consistent
||
$forceTableWrite
)
{
# consistent
$db
->
do
("
use
$database
");
$db
->
do
("
delete from attrib_type
");
...
...
@@ -82,6 +88,8 @@ for my $database (@dbnames) {
}
else
{
print
STDERR
"
Repairing
$database
, not consistent!
\n
";
repair
(
$attribs
,
$database
,
$db
);
print
STDERR
"
If you are sure the file is up to date, you can use the --force_table_write
"
.
"
to overwrite the information in the attrib_table, check RelCoord for more information
\n
";
}
}
...
...
@@ -271,7 +279,9 @@ sub usage {
"
port=i
",
\
$port
,
"
file=s
",
\
$file
,
"
dbnames=s@
",
\
@dbnames
,
"
release_num=i
",
\
$release_num
);
"
release_num=i
",
\
$release_num
,
"
nobackup
",
\
$nobackup
,
"
force_table_write
",
\
$forceTableWrite
);
print
STDERR
<<EOC;
Usage:
...
...
@@ -287,6 +297,14 @@ Usage:
Use --file ... if not using the default 'attrib_type.txt'.
The new option force_table_write has been introduced: when you run the script and there
is inconsistency between the database and the file (there is the "not consistent!!" in
the output), you should first ensure if the consistency is expected (some attributes were
removed from the file because they are not longer needed), or not expected (someone introduced
a new attribute_type in the database but forgot to update the attrib_type.txt file). In the first
situation, you should use the --force_table_write when running the script. In the second situation,
the new attrib_type must be added to the file and run it again without the force flag
EOC
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