A fake auction house I made for a school project.
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.
|
|
|
require_relative "db_models.rb"
|
|
|
|
|
|
|
|
LOAD_MODELS = [
|
|
|
|
User,
|
|
|
|
Role,
|
|
|
|
User_Role_relation,
|
|
|
|
Auction,
|
|
|
|
Bid,
|
|
|
|
Auction_Category_relation,
|
|
|
|
Category,
|
|
|
|
Image
|
|
|
|
]
|
|
|
|
|
|
|
|
def db_init
|
|
|
|
LOAD_MODELS.each do |model|
|
|
|
|
model.init_table # init all tables
|
|
|
|
end
|
|
|
|
|
|
|
|
# Create all default roles
|
|
|
|
q = "INSERT OR IGNORE INTO Role (id, name, color, flags) VALUES (?, ?, ?, ?)"
|
|
|
|
ROLES.each do |id, role|
|
|
|
|
Role.query(q, role[:id], role[:name], role[:color], role[:flags])
|
|
|
|
end
|
|
|
|
end
|