summaryrefslogtreecommitdiff
path: root/lib/output/pq/sql
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2021-06-27 18:59:21 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2021-06-27 18:59:21 +0100
commitd74a7b7aec40d83b940dbfe10850734075aa6c5c (patch)
treeb1e0050b6265b068956ae7d417e1d5d8baf7a985 /lib/output/pq/sql
parentBasic type mapper (diff)
downloadmygrate-d74a7b7aec40d83b940dbfe10850734075aa6c5c.tar.bz2
mygrate-d74a7b7aec40d83b940dbfe10850734075aa6c5c.tar.xz
mygrate-d74a7b7aec40d83b940dbfe10850734075aa6c5c.zip
Add an existing table to the config
Diffstat (limited to 'lib/output/pq/sql')
-rw-r--r--lib/output/pq/sql/insertColumn.sql2
-rw-r--r--lib/output/pq/sql/insertTable.sql3
-rw-r--r--lib/output/pq/sql/selectSourceSchema.sql3
3 files changed, 8 insertions, 0 deletions
diff --git a/lib/output/pq/sql/insertColumn.sql b/lib/output/pq/sql/insertColumn.sql
new file mode 100644
index 0000000..b8efde9
--- /dev/null
+++ b/lib/output/pq/sql/insertColumn.sql
@@ -0,0 +1,2 @@
+INSERT INTO mygrate.table_columns(column_name, mysql_ordinal, table_id)
+VALUES($1, $2, $3)
diff --git a/lib/output/pq/sql/insertTable.sql b/lib/output/pq/sql/insertTable.sql
new file mode 100644
index 0000000..4b559d0
--- /dev/null
+++ b/lib/output/pq/sql/insertTable.sql
@@ -0,0 +1,3 @@
+INSERT INTO mygrate.tables(table_name, source_id)
+VALUES($1, $2)
+RETURNING table_id
diff --git a/lib/output/pq/sql/selectSourceSchema.sql b/lib/output/pq/sql/selectSourceSchema.sql
new file mode 100644
index 0000000..a583c4f
--- /dev/null
+++ b/lib/output/pq/sql/selectSourceSchema.sql
@@ -0,0 +1,3 @@
+SELECT table_schema
+FROM mygrate.source s
+WHERE s.source_id = $1