-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
テストコードの最後でテーブルをクリアする処理を各テストファイルから clear_tables.nim に移動し、共通化しました。 これにより、テストファイル内のテーブルクリア処理が簡潔になり、コードの重複も解消されました。 各データベースエンジン(MySQL, MariaDB, PostgreSQL, SQLite)のテストで clear_tables モジュールをインポートし、テスト終了時に clearTables() を呼び出すように変更しています。
- Loading branch information
1 parent
b460a46
commit a867209
Showing
21 changed files
with
103 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import std/asyncdispatch | ||
import std/json | ||
import std/strformat | ||
import std/strutils | ||
import ../../../src/allographer/query_builder | ||
|
||
proc clearTables*(rdb:MariaDBConnections) {.async.} = | ||
let tables = rdb.table("_allographer_migrations").orderBy("id", Desc) .get().await | ||
for table in tables: | ||
let tableName = table["name"].getStr() | ||
if not tableName.startsWith("_"): | ||
rdb.raw(&"DROP TABLE IF EXISTS `{tableName}`").exec().await | ||
|
||
rdb.raw("DROP TABLE IF EXISTS `_allographer_migrations`").exec().await |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import std/asyncdispatch | ||
import std/json | ||
import std/strformat | ||
import std/strutils | ||
import ../../../src/allographer/query_builder | ||
|
||
proc clearTables*(rdb:MySQLConnections) {.async.} = | ||
let tables = rdb.table("_allographer_migrations").orderBy("id", Desc) .get().await | ||
for table in tables: | ||
let tableName = table["name"].getStr() | ||
if not tableName.startsWith("_"): | ||
rdb.raw(&"DROP TABLE IF EXISTS `{tableName}`").exec().await | ||
|
||
rdb.raw("DROP TABLE IF EXISTS `_allographer_migrations`").exec().await |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import std/asyncdispatch | ||
import std/json | ||
import std/strformat | ||
import std/strutils | ||
import ../../../src/allographer/query_builder | ||
|
||
proc clearTables*(rdb:PostgresConnections) {.async.} = | ||
let tables = rdb.table("_allographer_migrations").orderBy("id", Desc) .get().await | ||
for table in tables: | ||
let tableName = table["name"].getStr() | ||
if not tableName.startsWith("_"): | ||
rdb.raw(&"DROP TABLE IF EXISTS \"{tableName}\"").exec().await | ||
|
||
rdb.raw("DROP TABLE IF EXISTS \"_allographer_migrations\"").exec().await |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import std/asyncdispatch | ||
import std/json | ||
import std/strformat | ||
import std/strutils | ||
import ../../../src/allographer/query_builder | ||
|
||
proc clearTables*(rdb:SqliteConnections) {.async.} = | ||
let tables = rdb.table("_allographer_migrations").orderBy("id", Desc) .get().await | ||
for table in tables: | ||
let tableName = table["name"].getStr() | ||
if not tableName.startsWith("_"): | ||
rdb.raw(&"DROP TABLE IF EXISTS \"{tableName}\"").exec().await | ||
|
||
rdb.raw("DROP TABLE IF EXISTS \"_allographer_migrations\"").exec().await |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters