diff --git a/core/compilers.ts b/core/compilers.ts index 95b94b359..19f0ac1c0 100644 --- a/core/compilers.ts +++ b/core/compilers.ts @@ -122,7 +122,7 @@ function compileSqlx(rootNode: SyntaxTreeNode, path: string) { rootNode ); - const contextFunctions = ["self", "ref", "resolve", "name", "when", "incremental"] + const contextFunctions = ["self", "ref", "resolve", "name", "when", "incremental", "schema", "database"] .map(name => `const ${name} = ctx.${name} ? ctx.${name}.bind(ctx) : undefined;`) .join("\n"); diff --git a/tests/core/backslashes-act-literally.js.test b/tests/core/backslashes-act-literally.js.test index b7315d362..994a3658f 100644 --- a/tests/core/backslashes-act-literally.js.test +++ b/tests/core/backslashes-act-literally.js.test @@ -12,6 +12,8 @@ const resolve = ctx.resolve ? ctx.resolve.bind(ctx) : undefined; const name = ctx.name ? ctx.name.bind(ctx) : undefined; const when = ctx.when ? ctx.when.bind(ctx) : undefined; const incremental = ctx.incremental ? ctx.incremental.bind(ctx) : undefined; +const schema = ctx.schema ? ctx.schema.bind(ctx) : undefined; +const database = ctx.database ? ctx.database.bind(ctx) : undefined; return [` select @@ -31,6 +33,8 @@ const resolve = ctx.resolve ? ctx.resolve.bind(ctx) : undefined; const name = ctx.name ? ctx.name.bind(ctx) : undefined; const when = ctx.when ? ctx.when.bind(ctx) : undefined; const incremental = ctx.incremental ? ctx.incremental.bind(ctx) : undefined; +const schema = ctx.schema ? ctx.schema.bind(ctx) : undefined; +const database = ctx.database ? ctx.database.bind(ctx) : undefined; return [` select diff --git a/tests/core/backticks-are-escaped.js.test b/tests/core/backticks-are-escaped.js.test index e0ddec90d..79d83bcd5 100644 --- a/tests/core/backticks-are-escaped.js.test +++ b/tests/core/backticks-are-escaped.js.test @@ -12,6 +12,8 @@ const resolve = ctx.resolve ? ctx.resolve.bind(ctx) : undefined; const name = ctx.name ? ctx.name.bind(ctx) : undefined; const when = ctx.when ? ctx.when.bind(ctx) : undefined; const incremental = ctx.incremental ? ctx.incremental.bind(ctx) : undefined; +const schema = ctx.schema ? ctx.schema.bind(ctx) : undefined; +const database = ctx.database ? ctx.database.bind(ctx) : undefined; return [` select "\`" from \`location\` diff --git a/tests/core/basic-syntax.js.test b/tests/core/basic-syntax.js.test index 0ba7c80d7..ea22b331f 100644 --- a/tests/core/basic-syntax.js.test +++ b/tests/core/basic-syntax.js.test @@ -12,6 +12,8 @@ const resolve = ctx.resolve ? ctx.resolve.bind(ctx) : undefined; const name = ctx.name ? ctx.name.bind(ctx) : undefined; const when = ctx.when ? ctx.when.bind(ctx) : undefined; const incremental = ctx.incremental ? ctx.incremental.bind(ctx) : undefined; +const schema = ctx.schema ? ctx.schema.bind(ctx) : undefined; +const database = ctx.database ? ctx.database.bind(ctx) : undefined; return [` select * from ${ref('dab')} diff --git a/tests/core/js-placeholder-strings-inside-sql-strings.js.test b/tests/core/js-placeholder-strings-inside-sql-strings.js.test index 40a42dfd8..a057ad4a7 100644 --- a/tests/core/js-placeholder-strings-inside-sql-strings.js.test +++ b/tests/core/js-placeholder-strings-inside-sql-strings.js.test @@ -12,6 +12,8 @@ const resolve = ctx.resolve ? ctx.resolve.bind(ctx) : undefined; const name = ctx.name ? ctx.name.bind(ctx) : undefined; const when = ctx.when ? ctx.when.bind(ctx) : undefined; const incremental = ctx.incremental ? ctx.incremental.bind(ctx) : undefined; +const schema = ctx.schema ? ctx.schema.bind(ctx) : undefined; +const database = ctx.database ? ctx.database.bind(ctx) : undefined; return [` select '${`bar`}' diff --git a/tests/core/strings-act-literally.js.test b/tests/core/strings-act-literally.js.test index e4d49658e..b79eee893 100644 --- a/tests/core/strings-act-literally.js.test +++ b/tests/core/strings-act-literally.js.test @@ -12,6 +12,8 @@ const resolve = ctx.resolve ? ctx.resolve.bind(ctx) : undefined; const name = ctx.name ? ctx.name.bind(ctx) : undefined; const when = ctx.when ? ctx.when.bind(ctx) : undefined; const incremental = ctx.incremental ? ctx.incremental.bind(ctx) : undefined; +const schema = ctx.schema ? ctx.schema.bind(ctx) : undefined; +const database = ctx.database ? ctx.database.bind(ctx) : undefined; return [` select @@ -30,6 +32,8 @@ const resolve = ctx.resolve ? ctx.resolve.bind(ctx) : undefined; const name = ctx.name ? ctx.name.bind(ctx) : undefined; const when = ctx.when ? ctx.when.bind(ctx) : undefined; const incremental = ctx.incremental ? ctx.incremental.bind(ctx) : undefined; +const schema = ctx.schema ? ctx.schema.bind(ctx) : undefined; +const database = ctx.database ? ctx.database.bind(ctx) : undefined; return [` select