Updated postgres
This commit is contained in:
parent
fe44b0f60b
commit
bee328e1c1
4 changed files with 45 additions and 7 deletions
|
@ -27,7 +27,7 @@ dependency_overrides:
|
|||
path: ../angel_orm_test
|
||||
# angel3_orm_generator:
|
||||
# path: ../angel_orm_generator
|
||||
# angel3_orm:
|
||||
# path: ../angel_orm
|
||||
angel3_orm:
|
||||
path: ../angel_orm
|
||||
angel3_migration:
|
||||
path: ../angel_migration
|
||||
|
|
|
@ -36,7 +36,42 @@ Future<PostgreSqlExecutor> connectToPostgres(Iterable<String> schemas) async {
|
|||
|
||||
// Run sql to create the tables
|
||||
for (var s in schemas) {
|
||||
await conn.execute(await File('test/migrations/$s.sql').readAsString());
|
||||
var rawQueryString = await File('test/migrations/$s.sql').readAsString();
|
||||
print("Raw SQL Query: $rawQueryString");
|
||||
//await conn.execute(queryString);
|
||||
|
||||
// Split the queries and execute them
|
||||
var stringLen = rawQueryString.length;
|
||||
var index = 0;
|
||||
while (index < stringLen) {
|
||||
index = rawQueryString.indexOf(";");
|
||||
if (index < 0) {
|
||||
break;
|
||||
}
|
||||
var query = rawQueryString.substring(0, index);
|
||||
print("SQL Query: $query;");
|
||||
await conn.execute("$query;");
|
||||
|
||||
index++;
|
||||
if (index < stringLen) {
|
||||
var tempString = rawQueryString.substring(index).trim();
|
||||
rawQueryString = tempString;
|
||||
stringLen = rawQueryString.length;
|
||||
index = 0;
|
||||
}
|
||||
}
|
||||
/*
|
||||
var queryString = rawQueryString.replaceAll("\n", " ");
|
||||
print("Raw Query: $queryString");
|
||||
var queries = queryString.split(';');
|
||||
for (var rawQuery in queries) {
|
||||
var query = rawQuery.trim();
|
||||
if (query.isNotEmpty) {
|
||||
print("SQL Query: $query;");
|
||||
await conn.execute("$query;");
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
return PostgreSqlExecutor(conn, logger: Logger.root);
|
||||
|
|
|
@ -10,8 +10,11 @@ void customExprTests(FutureOr<QueryExecutor> Function() createExecutor,
|
|||
|
||||
close ??= (_) => null;
|
||||
|
||||
var hasExecutor = false;
|
||||
|
||||
setUp(() async {
|
||||
executor = await createExecutor();
|
||||
hasExecutor = true;
|
||||
|
||||
var now = DateTime.now();
|
||||
var nQuery = NumbersQuery();
|
||||
|
@ -25,7 +28,7 @@ void customExprTests(FutureOr<QueryExecutor> Function() createExecutor,
|
|||
});
|
||||
|
||||
tearDown(() {
|
||||
if (close != null) {
|
||||
if (hasExecutor && close != null) {
|
||||
close(executor);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -19,7 +19,7 @@ dev_dependencies:
|
|||
angel3_framework: ^8.0.0
|
||||
build_runner: ^2.4.0
|
||||
lints: ^3.0.0
|
||||
# dependency_overrides:
|
||||
dependency_overrides:
|
||||
# angel3_container:
|
||||
# path: ../../container/angel_container
|
||||
# angel3_framework:
|
||||
|
@ -36,8 +36,8 @@ dev_dependencies:
|
|||
# path: ../../serialize/angel_serialize
|
||||
# angel3_serialize_generator:
|
||||
# path: ../../serialize/angel_serialize_generator
|
||||
# angel3_orm:
|
||||
# path: ../angel_orm
|
||||
angel3_orm:
|
||||
path: ../angel_orm
|
||||
# angel3_migration:
|
||||
# path: ../angel_migration
|
||||
# angel3_orm_generator:
|
||||
|
|
Loading…
Reference in a new issue