Sha256: b6da10aeefbd90a1d1acbd35f0eeeef7870239821ddd45de13b141ef06ae403a
Contents?: true
Size: 861 Bytes
Versions: 3
Compression:
Stored size: 861 Bytes
Contents
# frozen_string_literal: true # database handling for eDen Db class Database class << self Sequel.extension :migration def db_access Sequel.connect("sqlite://eden.sqlite3") end def create_table(table_name) eden = Sequel.connect("sqlite://eden.sqlite3") unless eden.table_exists?(table_name) eden.create_table table_name.to_sym do primary_key "#{table_name}_id".to_sym end end end def create_column(table, column_name, type) eden = Sequel.connect("sqlite://eden.sqlite3") if eden.table_exists?(table) unless eden.schema(table).any? { |column| column.first == column_name } Sequel.migration do change do add_column table, column_name, type end end.apply(eden, :up) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
atome-0.5.6.2.7 | vendor/assets/server/database.rb |
atome-0.5.6.2.5 | vendor/assets/server/database.rb |
atome-0.5.6.2.4 | vendor/assets/server/database.rb |