{"action":"created","issue":{"url":"https://api.github.com/repos/mrjgreen/db-sync/issues/7","repository_url":"https://api.github.com/repos/mrjgreen/db-sync","labels_url":"https://api.github.com/repos/mrjgreen/db-sync/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/mrjgreen/db-sync/issues/7/comments","events_url":"https://api.github.com/repos/mrjgreen/db-sync/issues/7/events","html_url":"https://github.com/mrjgreen/db-sync/issues/7","id":119694835,"number":7,"title":"Do not sync table that does not have a primary key  ","user":{"login":"tmtben","id":10966627,"avatar_url":"https://avatars.githubusercontent.com/u/10966627?v=3","gravatar_id":"","url":"https://api.github.com/users/tmtben","html_url":"https://github.com/tmtben","followers_url":"https://api.github.com/users/tmtben/followers","following_url":"https://api.github.com/users/tmtben/following{/other_user}","gists_url":"https://api.github.com/users/tmtben/gists{/gist_id}","starred_url":"https://api.github.com/users/tmtben/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmtben/subscriptions","organizations_url":"https://api.github.com/users/tmtben/orgs","repos_url":"https://api.github.com/users/tmtben/repos","events_url":"https://api.github.com/users/tmtben/events{/privacy}","received_events_url":"https://api.github.com/users/tmtben/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-12-01T11:10:08Z","updated_at":"2016-03-30T14:07:16Z","closed_at":null,"body":"Don't ask me why but sometimes I've got some tables that do not have a primary key ;-)\r\n\r\nWhy not to sync such tables?\r\n\r\n  The table db.table does not have a primary key  \r\n                                                                                            \r\n#0 phar:///usr/bin/db-sync/src/Command/SyncCommand.php(178): DbSync\\DbSync->sync(Object(DbSync\\Table), Object(DbSync\\Table), Object(DbSync\\ColumnConfiguration), Object(DbSync\\ColumnConfiguration))\r\n#1 phar:///usr/bin/db-sync/src/Command/SyncCommand.php(110): DbSync\\Command\\SyncCommand->fire()\r\n#2 phar:///usr/bin/db-sync/vendor/symfony/console/Command/Command.php(259): DbSync\\Command\\SyncCommand->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\r\n#3 phar:///usr/bin/db-sync/bin/sync(75): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\r\n#4 phar:///usr/bin/db-sync/bin/sync(91): DbSync\\Command\\App->run(Object(DbSync\\Command\\SyncCommand))\r\n#5 /usr/bin/db-sync(12): require('phar:///usr/bin...')\r\n#6 {main}\r\n#0 phar:///usr/bin/db-sync/src/Command/SyncCommand.php(178): DbSync\\DbSync->sync(Object(DbSync\\Table), Object(DbSync\\Table), Object(DbSync\\ColumnConfiguration), Object(DbSync\\ColumnConfiguration))\r\n#1 phar:///usr/bin/db-sync/src/Command/SyncCommand.php(110): DbSync\\Command\\SyncCommand->fire()\r\n#2 phar:///usr/bin/db-sync/vendor/symfony/console/Command/Command.php(259): DbSync\\Command\\SyncCommand->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\r\n#3 phar:///usr/bin/db-sync/bin/sync(75): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))\r\n#4 phar:///usr/bin/db-sync/bin/sync(91): DbSync\\Command\\App->run(Object(DbSync\\Command\\SyncCommand))\r\n#5 /usr/bin/db-sync(12): require('phar:///usr/bin...')\r\n#6 {main}\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/mrjgreen/db-sync/issues/comments/203447860","html_url":"https://github.com/mrjgreen/db-sync/issues/7#issuecomment-203447860","issue_url":"https://api.github.com/repos/mrjgreen/db-sync/issues/7","id":203447860,"user":{"login":"mrjgreen","id":2183391,"avatar_url":"https://avatars.githubusercontent.com/u/2183391?v=3","gravatar_id":"","url":"https://api.github.com/users/mrjgreen","html_url":"https://github.com/mrjgreen","followers_url":"https://api.github.com/users/mrjgreen/followers","following_url":"https://api.github.com/users/mrjgreen/following{/other_user}","gists_url":"https://api.github.com/users/mrjgreen/gists{/gist_id}","starred_url":"https://api.github.com/users/mrjgreen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrjgreen/subscriptions","organizations_url":"https://api.github.com/users/mrjgreen/orgs","repos_url":"https://api.github.com/users/mrjgreen/repos","events_url":"https://api.github.com/users/mrjgreen/events{/privacy}","received_events_url":"https://api.github.com/users/mrjgreen/received_events","type":"User","site_admin":false},"created_at":"2016-03-30T14:07:16Z","updated_at":"2016-03-30T14:07:16Z","body":"Associative tables should also have a primary key - a compound key representing all items in the association. \n\nThe primary key does not have to be auto inc, DB sync will work just fine on properly modelled association tables. \n\nCheers\nJoe Green\n\n> On 30 Mar 2016, at 14:47, Phuong <notifications@github.com> wrote:\n> \n> Every table should probably have a key... What's the use case?\n> \n> Not every table in a relational database should have a primary key. An association / associative / relationship table is one such type of table. An associative table is a table that holds the relationship (usually many-to-many) between two tables. Having a primary key in these tables are not very useful and in some cases may add to the overhead like additional storage space for the primary key.\n> \n> That said... I think the overhead and time it takes to create a primary key for associative tables is probably less than trying to change this code to be able to handle tables without primary key.\n> \n> —\n> You are receiving this because you commented.\n> Reply to this email directly or view it on GitHub\n> \n"}}