{"action":"created","issue":{"url":"https://api.github.com/repos/snowplow/schema-guru/issues/159","repository_url":"https://api.github.com/repos/snowplow/schema-guru","labels_url":"https://api.github.com/repos/snowplow/schema-guru/issues/159/labels{/name}","comments_url":"https://api.github.com/repos/snowplow/schema-guru/issues/159/comments","events_url":"https://api.github.com/repos/snowplow/schema-guru/issues/159/events","html_url":"https://github.com/snowplow/schema-guru/issues/159","id":153208504,"number":159,"title":"Fix handling of new major schema version","user":{"login":"yalisassoon","id":201147,"avatar_url":"https://avatars.githubusercontent.com/u/201147?v=3","gravatar_id":"","url":"https://api.github.com/users/yalisassoon","html_url":"https://github.com/yalisassoon","followers_url":"https://api.github.com/users/yalisassoon/followers","following_url":"https://api.github.com/users/yalisassoon/following{/other_user}","gists_url":"https://api.github.com/users/yalisassoon/gists{/gist_id}","starred_url":"https://api.github.com/users/yalisassoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yalisassoon/subscriptions","organizations_url":"https://api.github.com/users/yalisassoon/orgs","repos_url":"https://api.github.com/users/yalisassoon/repos","events_url":"https://api.github.com/users/yalisassoon/events{/privacy}","received_events_url":"https://api.github.com/users/yalisassoon/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-05-05T10:48:14Z","updated_at":"2016-05-05T10:57:33Z","closed_at":"2016-05-05T10:57:33Z","body":"I just tried using schema guru to generate a new SQL table definition for a new schema version 2-0-0.\r\n\r\nThe expected behaviour:\r\n\r\n* Generate a new jsonpath file with version _2\r\n* Generate a new sql table definition file with version _2\r\n\r\nInstead it looks like the _1 version were updated with the fields in `2-0-0`.\r\n\r\nSteps to reproduce:\r\n\r\nI generated a 1-0-0 `schemas/com.example_company/example_event/1-0-0`:\r\n\r\n```json\r\n{\r\n\t\"$schema\": \"http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#\",\r\n\t\"description\": \"Schema for an example event\",\r\n\t\"self\": {\r\n\t\t\"vendor\": \"com.example_company\",\r\n\t\t\"name\": \"example_event\",\r\n\t\t\"format\": \"jsonschema\",\r\n\t\t\"version\": \"1-0-0\"\r\n\t},\r\n\r\n\t\"type\": \"object\",\r\n\t\"properties\": {\r\n\t\t\"exampleStringField\": {\r\n\t\t\t\"type\": \"string\",\r\n\t\t\t\"maxLength\": 255\r\n\t\t},\r\n\t\t\"exampleIntegerField\": {\r\n\t\t\t\"type\": \"integer\"\r\n\t\t},\r\n\t\t\"exampleNumericField\": {\r\n\t\t\t\"type\": \"number\",\r\n\t\t\t\"maxDecimal\": 3\r\n\t\t},\r\n\t\t\"exampleTimestampField\": {\r\n\t\t\t\"type\": \"string\",\r\n\t\t\t\"format\": \"date-time\"\r\n\t\t}\r\n\t},\r\n\t\"minProperties\":1,\r\n\t\"required\": [\"exampleStringField\", \"exampleIntegerField\"],\r\n\t\"additionalProperties\": false\r\n}\r\n```\r\n\r\nThen a new version 2-0-0 `schema/com.example_company/example_event/2-0-0`:\r\n\r\n```json\r\n{\r\n\t\"$schema\": \"http://iglucentral.com/schemas/com.snowplowanalytics.self-desc/schema/jsonschema/1-0-0#\",\r\n\t\"description\": \"Schema for an example event\",\r\n\t\"self\": {\r\n\t\t\"vendor\": \"com.example_company\",\r\n\t\t\"name\": \"example_event\",\r\n\t\t\"format\": \"jsonschema\",\r\n\t\t\"version\": \"1-0-0\"\r\n\t},\r\n\r\n\t\"type\": \"object\",\r\n\t\"properties\": {\r\n\t\t\"exampleStringField\": {\r\n\t\t\t\"type\": \"string\",\r\n\t\t\t\"maxLength\": 255\r\n\t\t},\r\n\t\t\"exampleBigIntField\": {\r\n\t\t\t\"type\": \"integer\",\r\n\t\t\t\"maximum\": 9223372036854775807,\r\n\t\t\t\"minimum\": -9223372036854775808\r\n\t\t},\r\n\t\t\"exampleSmallIntField\": {\r\n\t\t\t\"type\": \"integer\",\r\n\t\t\t\"maximum\": 32767,\r\n\t\t\t\"minimum\": -32768\r\n\t\t},\r\n\t\t\"exampleNumericField\": {\r\n\t\t\t\"type\": \"number\",\r\n\t\t\t\"maxDecimal\": 3\r\n\t\t},\r\n\t\t\"exampleNumericField2\": {\r\n\t\t\t\"type\": \"number\",\r\n\t\t\t\"maxDecimal\": 12\r\n\t\t},\r\n\t\t\"exampleTimestampField\": {\r\n\t\t\t\"type\": \"string\",\r\n\t\t\t\"format\": \"date-time\"\r\n\t\t}\r\n\t},\r\n\t\"minProperties\":1,\r\n\t\"required\": [\"exampleStringField\", \"exampleIntegerField\"],\r\n\t\"additionalProperties\": false\r\n}\r\n```\r\n\r\nRan schema guru at the command line:\r\n\r\n```\r\n$ ../../schema-guru-0.6.1 ddl --with-json-paths schemas/com.example_company/example_event/jsonschema --force\r\nFile [/Users/yalisassoon/Development/event-dictionaries/test/example-schema-registry/./sql/com.example_company/example_event_1.sql] was overriden successfully!\r\nFile [/Users/yalisassoon/Development/event-dictionaries/test/example-schema-registry/./jsonpaths/com.example_company/example_event_1.json] was overriden successfully!\r\n```\r\n\r\nInspecting the table definitions:\r\n\r\n```\r\n$ ls sql/com.example_company\r\nexample_event_1.sql\r\n$ cat sql/com.example_company/example_event_1.sql\r\n-- AUTO-GENERATED BY schema-ddl DO NOT EDIT\r\n-- Generator: schema-ddl 0.3.0\r\n-- Generated: 2016-05-05 11:40\r\n\r\nCREATE SCHEMA IF NOT EXISTS atomic;\r\n\r\nCREATE TABLE IF NOT EXISTS atomic.com_example_company_example_event_1 (\r\n    \"schema_vendor\"           VARCHAR(128)     ENCODE RUNLENGTH NOT NULL,\r\n    \"schema_name\"             VARCHAR(128)     ENCODE RUNLENGTH NOT NULL,\r\n    \"schema_format\"           VARCHAR(128)     ENCODE RUNLENGTH NOT NULL,\r\n    \"schema_version\"          VARCHAR(128)     ENCODE RUNLENGTH NOT NULL,\r\n    \"root_id\"                 CHAR(36)         ENCODE RAW       NOT NULL,\r\n    \"root_tstamp\"             TIMESTAMP        ENCODE LZO       NOT NULL,\r\n    \"ref_root\"                VARCHAR(255)     ENCODE RUNLENGTH NOT NULL,\r\n    \"ref_tree\"                VARCHAR(1500)    ENCODE RUNLENGTH NOT NULL,\r\n    \"ref_parent\"              VARCHAR(255)     ENCODE RUNLENGTH NOT NULL,\r\n    \"example_string_field\"    VARCHAR(255)     ENCODE LZO       NOT NULL,\r\n    \"example_big_int_field\"   BIGINT           ENCODE LZO,\r\n    \"example_numeric_field\"   DOUBLE PRECISION ENCODE RAW,\r\n    \"example_numeric_field2\"  DOUBLE PRECISION ENCODE RAW,\r\n    \"example_small_int_field\" SMALLINT         ENCODE LZO,\r\n    \"example_timestamp_field\" TIMESTAMP        ENCODE LZO,\r\n    FOREIGN KEY (root_id) REFERENCES atomic.events(event_id)\r\n)\r\nDISTSTYLE KEY\r\nDISTKEY (root_id)\r\nSORTKEY (root_tstamp);\r\n\r\nCOMMENT ON TABLE com_example_company_example_event_1 IS 'iglu:com.example_company/example_event/jsonschema/1-0-0';\r\n```\r\n\r\nNotes: \r\n\r\n1. the table fields are as per schema version 2-0-0\r\n2. the table name and filename both suggest major version 1\r\n3. the comment on table also suggests version 1\r\n"},"comment":{"url":"https://api.github.com/repos/snowplow/schema-guru/issues/comments/217124833","html_url":"https://github.com/snowplow/schema-guru/issues/159#issuecomment-217124833","issue_url":"https://api.github.com/repos/snowplow/schema-guru/issues/159","id":217124833,"user":{"login":"yalisassoon","id":201147,"avatar_url":"https://avatars.githubusercontent.com/u/201147?v=3","gravatar_id":"","url":"https://api.github.com/users/yalisassoon","html_url":"https://github.com/yalisassoon","followers_url":"https://api.github.com/users/yalisassoon/followers","following_url":"https://api.github.com/users/yalisassoon/following{/other_user}","gists_url":"https://api.github.com/users/yalisassoon/gists{/gist_id}","starred_url":"https://api.github.com/users/yalisassoon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yalisassoon/subscriptions","organizations_url":"https://api.github.com/users/yalisassoon/orgs","repos_url":"https://api.github.com/users/yalisassoon/repos","events_url":"https://api.github.com/users/yalisassoon/events{/privacy}","received_events_url":"https://api.github.com/users/yalisassoon/received_events","type":"User","site_admin":false},"created_at":"2016-05-05T10:57:33Z","updated_at":"2016-05-05T10:57:33Z","body":"My bad - I had the schema version wrong in the file. Closing - sorry!"}}