You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
437 B
24 lines
437 B
3 years ago
|
require_relative "db_models.rb"
|
||
|
|
||
3 years ago
|
LOAD_MODELS = [
|
||
3 years ago
|
User,
|
||
|
Role,
|
||
3 years ago
|
User_Role_relation,
|
||
|
Auction,
|
||
|
Auction_Category_relation,
|
||
|
Category,
|
||
|
Image
|
||
3 years ago
|
]
|
||
|
|
||
|
def db_init
|
||
3 years ago
|
LOAD_MODELS.each do |model|
|
||
|
model.init_table # init all tables
|
||
|
end
|
||
3 years ago
|
|
||
|
# Create all default roles
|
||
|
q = "INSERT OR IGNORE INTO Role (id, name, color, flags) VALUES (?, ?, ?, ?)"
|
||
|
ROLES.each do |id, role|
|
||
3 years ago
|
Role.query(q, role[:id], role[:name], role[:color], role[:flags])
|
||
3 years ago
|
end
|
||
3 years ago
|
end
|