Skip to content

Commit

Permalink
build: source formatting validation with EditorConfig (mikro-orm#376)
Browse files Browse the repository at this point in the history
  • Loading branch information
pepakriz authored Mar 1, 2020
1 parent 202470d commit a399168
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*.{js,ts}]
charset = utf-8
end_of_line = lf
trim_trailing_whitespace = true
insert_final_newline = true
indent_style = space
indent_size = 2
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ jobs:
with:
node-version: ${{ matrix.node-version }}

- name: EditorConfig Lint
uses: docker://mstruebing/editorconfig-checker:2.0.3

- name: Init docker
run: docker-compose up -d

Expand Down
12 changes: 6 additions & 6 deletions lib/schema/PostgreSqlSchemaHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ export class PostgreSqlSchemaHelper extends SchemaHelper {

private getIndexesSQL(tableName: string, schemaName: string): string {
return `select i.indexname as constraint_name, k.column_name, c.contype = 'u' as unique, c.contype = 'p' as primary
from pg_catalog.pg_indexes i
join pg_catalog.pg_constraint c on c.conname = i.indexname
join pg_catalog.pg_class rel on rel.oid = c.conrelid
join pg_catalog.pg_namespace nsp on nsp.oid = c.connamespace
join information_schema.key_column_usage k on k.constraint_name = c.conname and k.table_schema = 'public' and k.table_name = '${tableName}'
where nsp.nspname = '${schemaName}' and rel.relname = '${tableName}'`;
from pg_catalog.pg_indexes i
join pg_catalog.pg_constraint c on c.conname = i.indexname
join pg_catalog.pg_class rel on rel.oid = c.conrelid
join pg_catalog.pg_namespace nsp on nsp.oid = c.connamespace
join information_schema.key_column_usage k on k.constraint_name = c.conname and k.table_schema = 'public' and k.table_name = '${tableName}'
where nsp.nspname = '${schemaName}' and rel.relname = '${tableName}'`;
}

}

0 comments on commit a399168

Please sign in to comment.