Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename selected columns to guarantee correct case #7

Merged
merged 1 commit into from
Feb 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/mysql-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export class MySQL {
private async tableNames(): Promise<string[]> {
const schemaTables = await query<TableType>(
this.connection,
sql`SELECT table_name
sql`SELECT table_name as table_name
FROM information_schema.columns
WHERE table_schema = ${this.schema()}
GROUP BY table_name
Expand All @@ -90,7 +90,10 @@ export class MySQL {

const rawEnumRecords = await query<EnumRecord>(
this.connection,
sql`SELECT column_name, column_type, data_type
sql`SELECT
column_name as column_name,
column_type as column_type,
data_type as data_type
FROM information_schema.columns
WHERE data_type IN ('enum', 'set')
AND table_schema = ${this.schema()}
Expand All @@ -111,7 +114,12 @@ export class MySQL {

const tableColumns = await query<TableColumnType>(
this.connection,
sql`SELECT column_name, data_type, is_nullable, column_default, column_comment
sql`SELECT
column_name as column_name,
data_type as data_type,
is_nullable as is_nullable,
column_default as column_default,
column_comment as column_comment
FROM information_schema.columns
WHERE table_name = ${tableName}
AND table_schema = ${tableSchema}`
Expand Down