Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ensembl-gh-mirror
ensembl
Commits
209898c5
Commit
209898c5
authored
Jan 13, 2011
by
Andreas Kusalananda Kähäri
Browse files
Even better SQL for resolving colliding PKs.
parent
73daeb38
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
11 deletions
+19
-11
misc-scripts/production_database/scripts/push_master_tables.pl
...scripts/production_database/scripts/push_master_tables.pl
+19
-11
No files found.
misc-scripts/production_database/scripts/push_master_tables.pl
View file @
209898c5
...
...
@@ -431,19 +431,27 @@ foreach my $server (@servers) {
$pk
,
$master_pk
,
Dumper
(
$master_row
)
);
push
(
@
{
$sql
{
$dbname
}
},
sprintf
(
"
-- Entries with %s_id = %d
"
.
"
should change this to %d
\n
"
.
"
-- Useful SQL:
\n
",
$table
,
$pk
,
$master_pk
));
sprintf
(
"
-- Entries with %s_id = %d
"
.
"
should change this to %d
\n
"
.
"
-- Useful SQL:
\n
",
$table
,
$pk
,
$master_pk
)
);
foreach
$t
(
@
{
$tables
{
$table
}
}
)
{
push
(
@
{
$sql
{
$dbname
}
},
sprintf
(
"
-- UPDATE %s SET
"
.
"
%s_id = %d
"
.
"
WHERE %s_id = %s;
\n\n
",
$t
,
$table
,
$master_pk
,
$table
,
$pk
)
);
push
(
@
{
$sql
{
$dbname
}
},
sprintf
(
"
-- CREATE TABLE %s_dup LIKE %s
\n
",
$t
,
$t
),
sprintf
(
"
-- INSERT INTO %s_dup
\n
"
.
"
-- SELECT * FROM %s WHERE %s_id = %s;
\n
",
$t
,
$t
,
$table
,
$master_pk
),
sprintf
(
"
-- %s_dup now contains
"
.
"
unresolved collisions
\n
"
),
sprintf
(
"
-- UPDATE %s SET
"
.
"
%s_id = %d
"
.
"
WHERE %s_id = %s;
\n\n
",
$t
,
$table
,
$master_pk
,
$table
,
$pk
)
);
}
$is_missing
=
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