Created
November 4, 2022 07:43
-
-
Save nownabe/e63958ca42f11f871f2506be3a5802ba to your computer and use it in GitHub Desktop.
DatabaseCleaner for Spanner
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
class MyDeletionStrategy < DatabaseCleaner::ActiveRecord::Deletion | |
def delete_tables(connection, table_names) | |
# TODO | |
end | |
def delete_table(connection, table_name) | |
connection.execute("DELETE FROM #{connection.quote_table_name(table_name)} WHERE true") | |
end | |
end | |
DatabaseCleaner.strategy = MyDeletionStrategy.new | |
# https://github.com/DatabaseCleaner/database_cleaner-active_record/blob/main/lib/database_cleaner/active_record/deletion.rb#L25-L27 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment