Method: Meshchat::Configuration::Database.create_database

Defined in:
lib/meshchat/configuration/database.rb

.create_databaseObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/meshchat/configuration/database.rb', line 20

def create_database
  ActiveRecord::Migration.suppress_messages 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
        end
      end
    end
  end
end