Module: Meshchat::Configuration::Database
- Defined in:
- lib/meshchat/configuration/database.rb
Class Method Summary collapse
- .create_database ⇒ Object
-
.setup_storage ⇒ Object
Upon initial startup, instantiated the database this is used for storing the information of every node on the network.
Class Method Details
.create_database ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/meshchat/configuration/database.rb', line 20 def create_database ActiveRecord::Migration. do ActiveRecord::Schema.define do unless data_source_exists? :nodes create_table :nodes do |table| table.column :alias_name, :string table.column :uid, :string table.column :public_key, :string table.column :location_on_network, :string table.column :location_of_relay, :string table.column :on_local_network, :boolean, default: true, null: false table.column :on_relay, :boolean, default: false, null: false table. end end end end end |
.setup_storage ⇒ Object
Upon initial startup, instantiated the database this is used for storing the information of every node on the network
10 11 12 13 14 15 16 17 18 |
# File 'lib/meshchat/configuration/database.rb', line 10 def setup_storage ActiveRecord::Base.establish_connection( adapter: 'sqlite3', database: 'meshchat.sqlite3', pool: 128 ) create_database end |