Commit Graph

7 Commits

Author SHA1 Message Date
Daniel Lockyer
aad55e83d9 Added helper methods for detecting database from config
refs https://github.com/TryGhost/Toolbox/issues/213

- this means we can remove some more hardcoded strings and refactor
  database code to be more abstract
2022-03-28 13:54:50 +01:00
Daniel Lockyer
f77983061e Refactored exports into a class
- following internal feedback, a class with static methods makes more
  sense
2022-03-02 14:27:35 +01:00
Daniel Lockyer
032e9db2f1 Updated call signature of database-info lib
refs https://github.com/TryGhost/Toolbox/issues/174

- ok, iteration 3 on how this library should work
- 95% of my use cases just need to pass an knex instance and return if
  it's mysql/sqlite
- i don't want to have to initialize the class in this library to get
  that
- this commit reworks the public interface to return a function with
  some simple `is*` functions for those uses cases, or to return the
  class otherwise
2022-03-02 12:11:18 +01:00
Daniel Lockyer
d8d77ed0ba Added connection method to database info lib
- this allows you to pass in a different DB instance than the one that
  the library is initialized with
2022-03-01 16:05:27 +01:00
Daniel Lockyer
52eb3181ee Fixed undefined variable references
- this was missed during the previous refactoring
2022-03-01 09:04:05 +01:00
Daniel Lockyer
fbc2fc7f65 Altered function usage of @tryghost/database-info
refs https://github.com/TryGhost/Toolbox/issues/174

- this exposes `isMySQL` and `isSQLite` functions which can be used
  within Ghost to figure out which DB we are using
- also cleans up public properties of the class
2022-03-01 08:37:06 +01:00
Daniel Lockyer
70ecba06ca Added @trghost/database-info package
refs https://github.com/TryGhost/Toolbox/issues/175

- this library is a small utility around `knex` that returns info on the
  database used - particularly, the version used
- this will initially be used within Ghost but it can be extended to
  other databases and projects if needed
2022-01-18 09:06:44 +00:00