{"action":"created","issue":{"url":"https://api.github.com/repos/Starcounter/Starcounter/issues/3142","labels_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/3142/labels{/name}","comments_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/3142/comments","events_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/3142/events","html_url":"https://github.com/Starcounter/Starcounter/issues/3142","id":120236282,"number":3142,"title":"pnext: Implement schema upgrade","user":{"login":"k-rus","id":1726044,"avatar_url":"https://avatars.githubusercontent.com/u/1726044?v=3","gravatar_id":"","url":"https://api.github.com/users/k-rus","html_url":"https://github.com/k-rus","followers_url":"https://api.github.com/users/k-rus/followers","following_url":"https://api.github.com/users/k-rus/following{/other_user}","gists_url":"https://api.github.com/users/k-rus/gists{/gist_id}","starred_url":"https://api.github.com/users/k-rus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/k-rus/subscriptions","organizations_url":"https://api.github.com/users/k-rus/orgs","repos_url":"https://api.github.com/users/k-rus/repos","events_url":"https://api.github.com/users/k-rus/events{/privacy}","received_events_url":"https://api.github.com/users/k-rus/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Starcounter/Starcounter/labels/BAH","name":"BAH","color":"e102d8"}],"state":"open","locked":false,"assignee":{"login":"chrhol","id":1658979,"avatar_url":"https://avatars.githubusercontent.com/u/1658979?v=3","gravatar_id":"","url":"https://api.github.com/users/chrhol","html_url":"https://github.com/chrhol","followers_url":"https://api.github.com/users/chrhol/followers","following_url":"https://api.github.com/users/chrhol/following{/other_user}","gists_url":"https://api.github.com/users/chrhol/gists{/gist_id}","starred_url":"https://api.github.com/users/chrhol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrhol/subscriptions","organizations_url":"https://api.github.com/users/chrhol/orgs","repos_url":"https://api.github.com/users/chrhol/repos","events_url":"https://api.github.com/users/chrhol/events{/privacy}","received_events_url":"https://api.github.com/users/chrhol/received_events","type":"User","site_admin":false},"milestone":null,"comments":13,"created_at":"2015-12-03T18:19:45Z","updated_at":"2015-12-07T10:59:00Z","closed_at":null,"body":"Now metalayer provides an API function to alter table and add columns. What it does it creates layout and updates metadata. The function returns metalayaer handle. So the schema updates, need to decide about the upgrade, call the metalayer function with columns to add, retrieve layout handle and update .net metadata such as type binding into new layout handle. In Level1 the method is in `Starcounter.SqlProcessor.SqlProcessor` and is:\r\n```c#\r\ninternal static unsafe extern uint star_alter_table_add_columns(ulong context_handle,\r\n            string full_table_name, STAR_COLUMN_DEFINITION_HIGH* added_columns,\r\n            out ulong new_layout_handle);\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/Starcounter/Starcounter/issues/comments/162482783","html_url":"https://github.com/Starcounter/Starcounter/issues/3142#issuecomment-162482783","issue_url":"https://api.github.com/repos/Starcounter/Starcounter/issues/3142","id":162482783,"user":{"login":"eriohl","id":3438751,"avatar_url":"https://avatars.githubusercontent.com/u/3438751?v=3","gravatar_id":"","url":"https://api.github.com/users/eriohl","html_url":"https://github.com/eriohl","followers_url":"https://api.github.com/users/eriohl/followers","following_url":"https://api.github.com/users/eriohl/following{/other_user}","gists_url":"https://api.github.com/users/eriohl/gists{/gist_id}","starred_url":"https://api.github.com/users/eriohl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eriohl/subscriptions","organizations_url":"https://api.github.com/users/eriohl/orgs","repos_url":"https://api.github.com/users/eriohl/repos","events_url":"https://api.github.com/users/eriohl/events{/privacy}","received_events_url":"https://api.github.com/users/eriohl/received_events","type":"User","site_admin":false},"created_at":"2015-12-07T10:59:00Z","updated_at":"2015-12-07T10:59:00Z","body":"> > So what happens if you change the type of a column? Exception?\r\n\r\n> Yes.\r\n\r\nMaybe we should do the token+type key discussed earlier so that column with same token but different type is treated as a different column?\r\n\r\n> I am wonder what will happen if index on new layout and the same set specifier is created and the old index is dropped. Will the new index find all records including those having the old layout?\r\n\r\nOf course."}}