Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load Postgres fixtures in a single transaction, truncate all tables at once #198

Merged
merged 1 commit into from
Jan 17, 2023

Conversation

fetinin
Copy link
Contributor

@fetinin fetinin commented Jan 14, 2023

  1. Поправил загрузку фикстур и таблиц для Postgres, во время загрузки открывалась транзакция, но по факту не использовалась. Для Mysql такой проблемы нет, там транзакция используется.
  2. Сделал очистку таблиц через truncate. Теперь вместо выполнения запроса на каждую таблицу, выполняется один с перечнем всех таблиц.

@fetinin fetinin added the internal internal change label Jan 14, 2023
@fetinin fetinin force-pushed the imporve-pg-fixtures-load branch from 09c0de9 to 9657199 Compare January 14, 2023 15:55
@fetinin fetinin changed the title Load Postgres fixtures in single transaction, truncate all tables at once Load Postgres fixtures in a single transaction, truncate all tables at once Jan 14, 2023
@fetinin fetinin force-pushed the imporve-pg-fixtures-load branch from 9657199 to d5c6e1c Compare January 14, 2023 16:01
@leorush
Copy link
Contributor

leorush commented Jan 14, 2023

А можно сделать rollback этой транзакции?

@fetinin
Copy link
Contributor Author

fetinin commented Jan 14, 2023

А можно сделать rollback этой транзакции?

А он уже всегда делается по умолчанию, на 210 строке.
https://github.com/lamoda/gonkey/pull/198/files#diff-02e2fb091ec342ccfb9f5251c4ccb5d3f31e6be640a894ce0995570225e1f6c0L210
Если уже был сделан Commit, то Rollback ничего не сделает, а если не был, то всё же произойдет.

@fetinin fetinin added the skip-release skip release on merge to master label Jan 17, 2023
@fetinin fetinin merged commit e529fc4 into master Jan 17, 2023
@fetinin fetinin deleted the imporve-pg-fixtures-load branch January 17, 2023 15:32
@github-actions
Copy link

🚀 PR was released in v1.20.0 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal internal change released skip-release skip release on merge to master
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants