{"action":"created","issue":{"url":"https://api.github.com/repos/tabacitu/dick/issues/26","labels_url":"https://api.github.com/repos/tabacitu/dick/issues/26/labels{/name}","comments_url":"https://api.github.com/repos/tabacitu/dick/issues/26/comments","events_url":"https://api.github.com/repos/tabacitu/dick/issues/26/events","html_url":"https://github.com/tabacitu/dick/issues/26","id":105248316,"number":26,"title":"Multi-language CRUDs, entities, everything","user":{"login":"tabacitu","id":1032474,"avatar_url":"https://avatars.githubusercontent.com/u/1032474?v=3","gravatar_id":"","url":"https://api.github.com/users/tabacitu","html_url":"https://github.com/tabacitu","followers_url":"https://api.github.com/users/tabacitu/followers","following_url":"https://api.github.com/users/tabacitu/following{/other_user}","gists_url":"https://api.github.com/users/tabacitu/gists{/gist_id}","starred_url":"https://api.github.com/users/tabacitu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tabacitu/subscriptions","organizations_url":"https://api.github.com/users/tabacitu/orgs","repos_url":"https://api.github.com/users/tabacitu/repos","events_url":"https://api.github.com/users/tabacitu/events{/privacy}","received_events_url":"https://api.github.com/users/tabacitu/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/tabacitu/dick/labels/question","name":"question","color":"cc317c"}],"state":"closed","locked":false,"assignee":{"login":"tabacitu","id":1032474,"avatar_url":"https://avatars.githubusercontent.com/u/1032474?v=3","gravatar_id":"","url":"https://api.github.com/users/tabacitu","html_url":"https://github.com/tabacitu","followers_url":"https://api.github.com/users/tabacitu/followers","following_url":"https://api.github.com/users/tabacitu/following{/other_user}","gists_url":"https://api.github.com/users/tabacitu/gists{/gist_id}","starred_url":"https://api.github.com/users/tabacitu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tabacitu/subscriptions","organizations_url":"https://api.github.com/users/tabacitu/orgs","repos_url":"https://api.github.com/users/tabacitu/repos","events_url":"https://api.github.com/users/tabacitu/events{/privacy}","received_events_url":"https://api.github.com/users/tabacitu/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/tabacitu/dick/milestones/2","html_url":"https://github.com/tabacitu/dick/milestones/beta","labels_url":"https://api.github.com/repos/tabacitu/dick/milestones/2/labels","id":1121508,"number":2,"title":"beta","description":null,"creator":{"login":"tabacitu","id":1032474,"avatar_url":"https://avatars.githubusercontent.com/u/1032474?v=3","gravatar_id":"","url":"https://api.github.com/users/tabacitu","html_url":"https://github.com/tabacitu","followers_url":"https://api.github.com/users/tabacitu/followers","following_url":"https://api.github.com/users/tabacitu/following{/other_user}","gists_url":"https://api.github.com/users/tabacitu/gists{/gist_id}","starred_url":"https://api.github.com/users/tabacitu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tabacitu/subscriptions","organizations_url":"https://api.github.com/users/tabacitu/orgs","repos_url":"https://api.github.com/users/tabacitu/repos","events_url":"https://api.github.com/users/tabacitu/events{/privacy}","received_events_url":"https://api.github.com/users/tabacitu/received_events","type":"User","site_admin":false},"open_issues":2,"closed_issues":9,"state":"open","created_at":"2015-05-20T16:13:50Z","updated_at":"2015-09-10T07:06:35Z","due_on":null,"closed_at":null},"comments":5,"created_at":"2015-09-07T17:12:45Z","updated_at":"2015-09-10T09:04:15Z","closed_at":"2015-09-09T21:16:35Z","body":"By the end of the week, Dick will support multiple tongues - client's deadline. It's just a website, but let's think future-proof. Say you have an application that needs all db entities translated. Or most of them. Say:\r\n- products\r\n- categories\r\n- pages\r\n- news\r\n\r\nThe two best solutions I've found are:\r\n1) a new translation table for each entity (so we have products[id, price, timestamps] and product_translations[id, product_id, lang, name, description]);\r\nPROs:\r\n- This seems the closest to the db normal form; I'm sure my university professors will bow to me and congratulate their young padawan for putting standards over ease of use;\r\nCONs:\r\n- This will mean we need a new table for each entity (so twice the number of tables in the db) and a complete overhaul of how the CRUD works. When a user updates a product (price, name, desc) you need to update some items in the products table, some in the product_translations; it will get very messy very fast;\r\n- This will definitely raise the number of queries in the application and/or query time; two tables are slower than one;\r\n\r\n2) store all translations as child products (so we add a few columns to the products table: lang and translation_of);\r\nPROs:\r\n- Faster to implement: since the CRUD will work just as it is now, we only need to add links to edit/delete the corresponding translations);\r\n- Faster to run: this will keep the number of db tables down;\r\n- Faster to upgrade to: this will make it easy to turn a single-language to a multi-language application;\r\nCONs:\r\n- This does mean that the products table won't have a different product on each row; which is... non-standard? Right?\r\n\r\nI like solution number two better, but I need someone to tell me I'm sane for thinking that's a really good compromise and normal form is not such a big deal.\r\n\r\n @Ghitu , @eugentudorache , @cristiantone , what do you think? Please reply."},"comment":{"url":"https://api.github.com/repos/tabacitu/dick/issues/comments/139176251","html_url":"https://github.com/tabacitu/dick/issues/26#issuecomment-139176251","issue_url":"https://api.github.com/repos/tabacitu/dick/issues/26","id":139176251,"user":{"login":"noxify","id":521777,"avatar_url":"https://avatars.githubusercontent.com/u/521777?v=3","gravatar_id":"","url":"https://api.github.com/users/noxify","html_url":"https://github.com/noxify","followers_url":"https://api.github.com/users/noxify/followers","following_url":"https://api.github.com/users/noxify/following{/other_user}","gists_url":"https://api.github.com/users/noxify/gists{/gist_id}","starred_url":"https://api.github.com/users/noxify/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/noxify/subscriptions","organizations_url":"https://api.github.com/users/noxify/orgs","repos_url":"https://api.github.com/users/noxify/repos","events_url":"https://api.github.com/users/noxify/events{/privacy}","received_events_url":"https://api.github.com/users/noxify/received_events","type":"User","site_admin":false},"created_at":"2015-09-10T09:04:15Z","updated_at":"2015-09-10T09:04:15Z","body":"awesome @tabacitu - good work!"}}