summaryrefslogtreecommitdiffstats
path: root/Bugzilla/DB/Schema
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2009-10-24 07:30:14 +0200
committermkanat%bugzilla.org <>2009-10-24 07:30:14 +0200
commit4adf7f1b401955a1938cfc7a9decdc77af2fab20 (patch)
tree9c52432a54f1769513b89e1d12ee8fc65960769c /Bugzilla/DB/Schema
parentbb7585e3e91f156493eb14d4f052e169bdf0207f (diff)
downloadbugzilla-4adf7f1b401955a1938cfc7a9decdc77af2fab20.tar.gz
bugzilla-4adf7f1b401955a1938cfc7a9decdc77af2fab20.tar.xz
Bug 519584: Implement a framework for migrating from other bug-trackers, and start with a GNATS importer.
Patch by Max Kanat-Alexander <mkanat@bugzilla.org> (module owner) a=mkanat
Diffstat (limited to 'Bugzilla/DB/Schema')
-rw-r--r--Bugzilla/DB/Schema/Mysql.pm5
-rw-r--r--Bugzilla/DB/Schema/Oracle.pm9
-rw-r--r--Bugzilla/DB/Schema/Pg.pm6
3 files changed, 20 insertions, 0 deletions
diff --git a/Bugzilla/DB/Schema/Mysql.pm b/Bugzilla/DB/Schema/Mysql.pm
index 95ef3141e..a68c7c90d 100644
--- a/Bugzilla/DB/Schema/Mysql.pm
+++ b/Bugzilla/DB/Schema/Mysql.pm
@@ -263,6 +263,11 @@ sub get_rename_indexes_ddl {
return ($sql);
}
+sub get_set_serial_sql {
+ my ($self, $table, $column, $value) = @_;
+ return ("ALTER TABLE $table AUTO_INCREMENT = $value");
+}
+
# Converts a DBI column_info output to an abstract column definition.
# Expects to only be called by Bugzila::DB::Mysql::_bz_build_schema_from_disk,
# although there's a chance that it will also work properly if called
diff --git a/Bugzilla/DB/Schema/Oracle.pm b/Bugzilla/DB/Schema/Oracle.pm
index 615987b06..814a842b3 100644
--- a/Bugzilla/DB/Schema/Oracle.pm
+++ b/Bugzilla/DB/Schema/Oracle.pm
@@ -403,4 +403,13 @@ sub _get_create_seq_ddl {
return @ddl;
}
+sub get_set_serial_sql {
+ my ($self, $table, $column, $value) = @_;
+ my @sql;
+ my $seq_name = "${table}_${column}_SEQ";
+ push(@sql, "DROP SEQUENCE ${seq_name}");
+ push(@sql, $self->_get_create_seq_ddl($table, $column, $value));
+ return @sql;
+}
+
1;
diff --git a/Bugzilla/DB/Schema/Pg.pm b/Bugzilla/DB/Schema/Pg.pm
index 070c0b03e..3559bae9c 100644
--- a/Bugzilla/DB/Schema/Pg.pm
+++ b/Bugzilla/DB/Schema/Pg.pm
@@ -119,6 +119,12 @@ sub get_rename_table_sql {
return ("ALTER TABLE $old_name RENAME TO $new_name");
}
+sub get_set_serial_sql {
+ my ($self, $table, $column, $value) = @_;
+ return ("SELECT setval('${table}_${column}_seq', $value, false)
+ FROM $table");
+}
+
sub _get_alter_type_sql {
my ($self, $table, $column, $new_def, $old_def) = @_;
my @statements;