summaryrefslogtreecommitdiff
path: root/lib/support/mysql-postgresql-converter/db_converter.py
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2015-09-18 16:33:38 +0200
committerJacob Vosmaer <contact@jacobvosmaer.nl>2015-09-18 16:57:33 +0200
commitb9bbad5298e2d50bb424dad2f91a1ab75a36c687 (patch)
treef8671b2a21adb622d1f9e62f52e821c85b10d90b /lib/support/mysql-postgresql-converter/db_converter.py
parentbf1e976d918bc343a0739e05c6f62c76f4035ba2 (diff)
downloadgitlab-ci-b9bbad5298e2d50bb424dad2f91a1ab75a36c687.tar.gz
Integrate mysql-to-postgres conversion
Diffstat (limited to 'lib/support/mysql-postgresql-converter/db_converter.py')
-rw-r--r--lib/support/mysql-postgresql-converter/db_converter.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/support/mysql-postgresql-converter/db_converter.py b/lib/support/mysql-postgresql-converter/db_converter.py
index 8a7f8a2..38a0572 100644
--- a/lib/support/mysql-postgresql-converter/db_converter.py
+++ b/lib/support/mysql-postgresql-converter/db_converter.py
@@ -15,7 +15,7 @@ import time
import subprocess
-def parse(input_filename, output_filename):
+def parse(input_filename, output_filename, drop_index_filename):
"Feed it a file, and it'll output a fixed one"
# State storage
@@ -44,6 +44,8 @@ def parse(input_filename, output_filename):
output = open(output_filename, "w")
logging = sys.stdout
+ drop_index = open(drop_index_filename, "w")
+
if input_filename == "-":
input_fh = sys.stdin
else:
@@ -234,12 +236,9 @@ def parse(input_filename, output_filename):
for line in sequence_lines:
output.write("%s;\n" % line)
- # This line is an anchor for move_drop_indexes.ed
- output.write("\n-- Drop indexes --\n")
+ drop_index.write("-- Drop indexes --\n")
for line in drop_index_lines:
- output.write("%s;\n" % line)
- # This line is an anchor for move_drop_indexes.ed
- output.write("-- END Drop indexes --\n")
+ drop_index.write("%s;\n" % line)
# Write indexes out
output.write("\n-- Indexes --\n")
@@ -253,4 +252,4 @@ def parse(input_filename, output_filename):
if __name__ == "__main__":
- parse(sys.argv[1], sys.argv[2])
+ parse(sys.argv[1], sys.argv[2], sys.argv[3])