This commit is contained in:
0x1eef 2024-04-26 23:44:20 -03:00
parent 73c80f116a
commit e7f910be5f

View file

@ -7,16 +7,16 @@ module Twenty
## ##
# @return [String] # @return [String]
# Returns the location of the default SQLite database. # Returns the default path for the SQLite database
def self.default_database def self.default_database
@default_database ||= File.join(Path.datadir, "database.sqlite") @default_database ||= File.join(Path.datadir, "database.sqlite")
end end
## ##
# Establishes a database connection. # Establishes a database connection
# #
# @param [String] path # @param [String] path
# The path to a SQLite3 database file. # The path to a SQLite database
# #
# @return [void] # @return [void]
def self.establish_connection(path:) def self.establish_connection(path:)
@ -26,6 +26,9 @@ module Twenty
) )
end end
##
# @return [Sequel::Database::SQLite]
# Returns the connection to a database
def self.connection def self.connection
establish_connection unless @connection establish_connection unless @connection
@connection @connection