Skip to content

Instantly share code, notes, and snippets.

@symkat
Created May 30, 2011 16:27
Show Gist options
  • Save symkat/999118 to your computer and use it in GitHub Desktop.
Save symkat/999118 to your computer and use it in GitHub Desktop.
SQL::Translator::Producer::SQL Patch - Correct an issue where tables, views and triggers are not added to the global names data structure and may result in collisions of table names of indexes or constraints.
--- /root/perl5/lib/perl5/SQL/Translator/Producer/SQLite.pm.bak 2011-05-23 14:52:20.000000000 -0700
+++ /root/perl5/lib/perl5/SQL/Translator/Producer/SQLite.pm 2011-05-30 09:23:58.000000000 -0700
@@ -133,6 +133,8 @@
my $add_drop_view = $options->{add_drop_view};
my $view_name = $view->name;
+ $global_names{$view_name} = 1;
+
debug("PKG: Looking at view '${view_name}'\n");
# Header. Should this look like what mysqldump produces?
@@ -165,6 +167,8 @@
my ($table, $options) = @_;
my $table_name = $table->name;
+ $global_names{$table_name} = 1;
+
my $no_comments = $options->{no_comments};
my $add_drop_table = $options->{add_drop_table};
my $sqlite_version = $options->{sqlite_version} || 0;
@@ -376,6 +380,8 @@
my @statements;
my $trigger_name = $trigger->name;
+ $global_names{$trigger_name} = 1;
+
my $events = $trigger->database_events;
for my $evt ( @$events ) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment