Module: Twenty

Defined in:
lib/twenty/server.rb,
lib/twenty/server/model/project.rb

Defined Under Namespace

Modules: GraphQL, Migration, Mixin, Model, Rack Classes: Project, Task

Class Method Summary collapse

Class Method Details

.connectionSequel::Database::SQLite

Returns the connection to a database

Returns:

  • (Sequel::Database::SQLite)

    Returns the connection to a database



59
60
61
62
# File 'lib/twenty/server.rb', line 59

def self.connection
  establish_connection unless @connection
  @connection
end

.establish_connection(path:) ⇒ void

This method returns an undefined value.

Establishes a database connection

Parameters:

  • path (String)

    The path to a SQLite database



49
50
51
52
53
54
# File 'lib/twenty/server.rb', line 49

def self.establish_connection(path:)
  @connection = Sequel.connect(
    adapter: "sqlite",
    database: path
  )
end