@@ -84,22 +84,20 @@ private async Task CreateDbAsync(CancellationToken cancellationToken)
8484 {
8585 _logger . LogInformation ( "Creating database..." ) ;
8686
87- var dbConnection = Connection ;
88-
8987 _logger . LogDebug ( "Dropping endpoints table..." ) ;
90- var dropTable = dbConnection . CreateCommand ( ) ;
88+ var dropTable = Connection . CreateCommand ( ) ;
9189 dropTable . CommandText = "DROP TABLE IF EXISTS endpoints" ;
9290 _ = await dropTable . ExecuteNonQueryAsync ( cancellationToken ) ;
9391
9492 _logger . LogDebug ( "Creating endpoints table..." ) ;
95- var createTable = dbConnection . CreateCommand ( ) ;
93+ var createTable = Connection . CreateCommand ( ) ;
9694 // when you change the schema, increase the db version number in ProxyUtils
9795 createTable . CommandText = "CREATE TABLE IF NOT EXISTS endpoints (path TEXT, graphVersion TEXT, hasSelect BOOLEAN)" ;
9896 _ = await createTable . ExecuteNonQueryAsync ( cancellationToken ) ;
9997
10098 _logger . LogDebug ( "Creating index on endpoints and version..." ) ;
10199 // Add an index on the path and graphVersion columns
102- var createIndex = dbConnection . CreateCommand ( ) ;
100+ var createIndex = Connection . CreateCommand ( ) ;
103101 createIndex . CommandText = "CREATE INDEX IF NOT EXISTS idx_endpoints_path_version ON endpoints (path, graphVersion)" ;
104102 _ = await createIndex . ExecuteNonQueryAsync ( cancellationToken ) ;
105103 }
@@ -108,8 +106,6 @@ private async Task FillDataAsync(CancellationToken cancellationToken)
108106 {
109107 _logger . LogInformation ( "Filling database..." ) ;
110108
111- var dbConnection = Connection ;
112-
113109 var i = 0 ;
114110
115111 foreach ( var openApiDocument in _openApiDocuments )
@@ -121,7 +117,7 @@ private async Task FillDataAsync(CancellationToken cancellationToken)
121117
122118 _logger . LogDebug ( "Filling database for {GraphVersion}..." , graphVersion ) ;
123119
124- var insertEndpoint = dbConnection . CreateCommand ( ) ;
120+ var insertEndpoint = Connection . CreateCommand ( ) ;
125121 insertEndpoint . CommandText = "INSERT INTO endpoints (path, graphVersion, hasSelect) VALUES (@path, @graphVersion, @hasSelect)" ;
126122 _ = insertEndpoint . Parameters . Add ( new ( "@path" , null ) ) ;
127123 _ = insertEndpoint . Parameters . Add ( new ( "@graphVersion" , null ) ) ;
0 commit comments