@@ -26,11 +26,21 @@ class DatabaseUtils private constructor() {
2626 LaravelQuerySettings .getInstance(this ).interestedIn(it)
2727 }
2828
29+ fun Project.dbDataSources (): Stream <out DbDataSource > =
30+ DbUtil .getDataSources(this ).toList().stream().filter {
31+ LaravelQuerySettings .getInstance(this ).interestedIn(it)
32+ }
33+
2934 fun DbDataSource.schemasInParallel (): Stream <out DasNamespace > =
3035 DasUtil .getSchemas(this ).toList().parallelStream().filter {
3136 LaravelQuerySettings .getInstance(this .project).interestedIn(it, this )
3237 }.filter { ! SchemasToSkip .contains(it.name) }
3338
39+ fun DbDataSource.schemas (): Stream <out DasNamespace > =
40+ DasUtil .getSchemas(this ).toList().stream().filter {
41+ LaravelQuerySettings .getInstance(this .project).interestedIn(it, this )
42+ }.filter { ! SchemasToSkip .contains(it.name) }
43+
3444 fun DbDataSource.tables () =
3545 DasUtil .getTables(this ).filter {
3646 LaravelQuerySettings .getInstance(this .project).interestedIn(it, this )
@@ -45,24 +55,49 @@ class DatabaseUtils private constructor() {
4555 ! it.isSystem && ! SchemasToSkip .contains(it.dasParent?.name)
4656 }.filter { it.isPrefixed(this .project) }
4757
58+ fun DbDataSource.tablesSequential (): Stream <out DasTable > =
59+ DasUtil .getTables(this ).toList().stream().filter {
60+ LaravelQuerySettings .getInstance(this .project).interestedIn(it, this )
61+ }.filter {
62+ ! it.isSystem && ! SchemasToSkip .contains(it.dasParent?.name)
63+ }.filter { it.isPrefixed(this .project) }
64+
4865 fun DasNamespace.tablesInParallel (project : Project ): Stream <out DasTable > =
4966 this .getDasChildren(ObjectKind .TABLE ).toList().parallelStream()
5067 .map { it as DasTable }
5168 .filter { ! it.isSystem }
5269 .filter { it.isPrefixed(project) }
5370
71+ fun DasNamespace.tables (project : Project ): Stream <out DasTable > =
72+ this .getDasChildren(ObjectKind .TABLE ).toList().stream()
73+ .map { it as DasTable }
74+ .filter { ! it.isSystem }
75+ .filter { it.isPrefixed(project) }
76+
5477 fun DasTable.columnsInParallel (): Stream <out DasColumn > =
5578 this .getDasChildren(ObjectKind .COLUMN ).toList().parallelStream().map { it as DasColumn }
5679
80+ fun DasTable.columns (): Stream <out DasColumn > =
81+ this .getDasChildren(ObjectKind .COLUMN ).toList().stream().map { it as DasColumn }
82+
5783 fun DasTable.indexesInParallel (): Stream <out DasIndex > =
5884 this .getDasChildren(ObjectKind .INDEX ).toList().parallelStream().map { it as DasIndex }
5985
86+ fun DasTable.indexes (): Stream <out DasIndex > =
87+ this .getDasChildren(ObjectKind .INDEX ).toList().stream().map { it as DasIndex }
88+
6089 fun DasTable.keysInParallel (): Stream <out DasTableKey > =
6190 this .getDasChildren(ObjectKind .KEY ).toList().parallelStream().map { it as DasTableKey }
6291
92+ fun DasTable.keys (): Stream <out DasTableKey > =
93+ this .getDasChildren(ObjectKind .KEY ).toList().stream().map { it as DasTableKey }
94+
6395 fun DasTable.foreignKeysInParallel (): Stream <out DasForeignKey > =
6496 this .getDasChildren(ObjectKind .FOREIGN_KEY ).toList().parallelStream().map { it as DasForeignKey }
6597
98+ fun DasTable.foreignKeys (): Stream <out DasForeignKey > =
99+ this .getDasChildren(ObjectKind .FOREIGN_KEY ).toList().stream().map { it as DasForeignKey }
100+
66101 private fun DasTable.isPrefixed (project : Project ): Boolean =
67102 this .name.startsWith(LaravelQuerySettings .getInstance(project).tablePrefix)
68103
0 commit comments