Module: Twenty

Extended by:
FileUtils
Defined in:
lib/twenty-backend.rb

Defined Under Namespace

Modules: ColorableMixin, GraphQL, Migration Classes: Model, Project, Servlet, Task

Class Method Summary collapse

Class Method Details

.data_dirString

Returns the directory where twenty stores data.

Returns:

  • (String)

    Returns the directory where twenty stores data.



16
17
18
# File 'lib/twenty-backend.rb', line 16

def self.data_dir
  File.join(Dir.home, ".local", "share", "20")
end

.default_databaseString

Returns the location of the default SQLite database.

Returns:

  • (String)

    Returns the location of the default SQLite database.



23
24
25
# File 'lib/twenty-backend.rb', line 23

def self.default_database
  @default_database ||= File.join(data_dir, "database.sqlite")
end

.establish_connection(path:) ⇒ void

This method returns an undefined value.

Establishes a database connection.

Parameters:

  • path (String)

    The path to a SQLite3 database file.



34
35
36
37
38
39
40
# File 'lib/twenty-backend.rb', line 34

def self.establish_connection(path:)
  ActiveRecord::Base.establish_connection(
    adapter: "sqlite3",
    database: path,
    pool: 16
  )
end