Sha256: b8c034ac72f246b0b9c2c0d1b715c90f6bb5220020fed08bb6fe7856ab4ad521
Contents?: true
Size: 929 Bytes
Versions: 4
Compression:
Stored size: 929 Bytes
Contents
# -*- coding: utf-8 -*- require 'sequel' require 'yaml' require 'erb' module Schema extend self def connect(str) @db = Sequel.connect(str) end def current_connect @db end def config(env,file) YAML::load(ERB.new(IO.read(file)).result)[env] end attr_reader :db def table_exists?(table_name) @db.table_exists? table_name end def create! Sequel::MySQL.default_charset = 'utf8' Sequel::MySQL.default_engine = 'InnoDB' models.each { |model| model.create_table! } @db.create_table? :users_accounts do primary_key :id, :type=>Integer Fixnum :user_id, :null => false Fixnum :account_id, :null => false end end def drop! models.each { |model| @db.drop_table(model.table_name) } end def models @models ||= [Account, User, Authz,Tag,TagMapping,Information ].freeze end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
wakame-vdc-webui-11.12.0 | app/models/schema.rb |
wakame-vdc-webui-11.06.0 | app/models/schema.rb |
wakame-vdc-webui-10.12.0 | app/models/schema.rb |
wakame-vdc-webui-10.11.0 | app/models/schema.rb |