{"action":"opened","issue":{"url":"https://api.github.com/repos/jinzhu/gorm/issues/418","labels_url":"https://api.github.com/repos/jinzhu/gorm/issues/418/labels{/name}","comments_url":"https://api.github.com/repos/jinzhu/gorm/issues/418/comments","events_url":"https://api.github.com/repos/jinzhu/gorm/issues/418/events","html_url":"https://github.com/jinzhu/gorm/issues/418","id":61067610,"number":418,"title":"Incorrect database creation?","user":{"login":"VasilyPupkin","id":329535,"avatar_url":"https://avatars.githubusercontent.com/u/329535?v=3","gravatar_id":"","url":"https://api.github.com/users/VasilyPupkin","html_url":"https://github.com/VasilyPupkin","followers_url":"https://api.github.com/users/VasilyPupkin/followers","following_url":"https://api.github.com/users/VasilyPupkin/following{/other_user}","gists_url":"https://api.github.com/users/VasilyPupkin/gists{/gist_id}","starred_url":"https://api.github.com/users/VasilyPupkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VasilyPupkin/subscriptions","organizations_url":"https://api.github.com/users/VasilyPupkin/orgs","repos_url":"https://api.github.com/users/VasilyPupkin/repos","events_url":"https://api.github.com/users/VasilyPupkin/events{/privacy}","received_events_url":"https://api.github.com/users/VasilyPupkin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-03-13T13:49:31Z","updated_at":"2015-03-13T13:49:31Z","closed_at":null,"body":"\"github.com/mattn/go-sqlite3\"\r\n\r\n\tClient struct {\r\n\t\tID        int\r\n\t\tIp        string `sql:\"not null;unique;index:idx_ip\"`\r\n\t\tModel     string `sql:\"not null;unique;index:idx_model\"`\r\n\t\tService   string `sql:\"not null;index:idx_service\"`\r\n\t\tCrashes   []Media\r\n\t\tPlayed    []Media\r\n\t\tSupported []Media\r\n\t}\r\n\r\n\tCategory struct {\r\n\t\tID       int\r\n\t\tCategory string `sql:\"not null;unique;index:idx_category\"`\r\n\t}\r\n\r\n\tMedia struct {\r\n\t\tID       int\r\n\t\tRemote   bool\r\n\t\tResource string `sql:\"not null;unique;index:idx_resource\"`\r\n\t\tLibrary  Library\r\n\t\tDuration int64\r\n\t\tCategory Category\r\n\t\tSubtype  string `sql:\"not null\"`\r\n\t}\r\n\r\n\tLibrary struct {\r\n\t\tID   int\r\n\t\tName string `sql:\"not null;unique;index:idx_library_name\"`\r\n\t\tPath string `sql:\"not null;unique;index:idx_library_path\"`\r\n\t}\r\n\r\nmaps to this:\r\n\r\nPRAGMA foreign_keys=OFF;\r\nBEGIN TRANSACTION;\r\nCREATE TABLE \"clients\" (\"id\" integer,\"ip\" varchar(255) NOT NULL UNIQUE,\"model\" varchar(255) NOT NULL UNIQUE,\"service\" varchar(255) NOT NULL  , PRIMARY KEY (id));\r\nCREATE TABLE \"medias\" (\"id\" integer,\"remote\" bool,\"resource\" varchar(255) NOT NULL UNIQUE,\"duration\" bigint,\"subtype\" varchar(255) NOT NULL  , PRIMARY KEY (id));\r\nCREATE TABLE \"categories\" (\"id\" integer,\"category\" varchar(255) NOT NULL UNIQUE , PRIMARY KEY (id));\r\nCREATE TABLE \"libraries\" (\"id\" integer,\"name\" varchar(255) NOT NULL UNIQUE,\"path\" varchar(255) NOT NULL UNIQUE , PRIMARY KEY (id));\r\nCOMMIT;\r\n"}}