i want develop currency system on custom forum i've been working on, don't know best approach.
should add new "gold" field user table , increment sql statements?
id, user, pass, created_at, gold
logic: user creates new forum post; update user table: gold + 1
or
should add transactions table logs , count user = x?
id, user_id, amount 1 3 1 (new forum post) 2 3 1 (new forum post) 3 12 -5 (item purchase) 4 3 -1 (deleted post) 5 9 1 (new forum post) or there better approach?
it highly depends on want , way program prefer.
to approach facts though:
i expect forum fast. should use simple
select. functionssum()take bit more time perform. in small system not problem, mysql-db scale bad, should keep in mind beginning.you want way track transactions. able check going on. if make great system deal gold still want track happened time time. it's handier store transactions.
redundant data , transaction synchronization can problem. every transaction system has problem keep synchronized. mysql that's not difficult, tables can locked while perform transactions. redundant data way more of pain. have ensure change data everywhere @ same time before other actions can interfere.
on basic system store data in user-table , keep transactions log in table. never use output user. further depends on system needs.
Comments
Post a Comment