GitHub PullRequestReviewCommentEvent at 2014-08-12 06:24:08
Repository: cliche
Actor: sjw0687
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/clicheio/cliche/pulls/comments/16097301","id":16097301,"diff_hunk":"@@ -8,32 +8,199 @@\n from sqlalchemy.types import Date, DateTime, Integer, String\n \n from .orm import Base\n-from .people import Team\n+from .people import Person, Team\n \n-__all__ = 'Work',\n+__all__ = 'Award', 'Genre', 'PersonAward', 'Work', 'WorkAward', 'WorkGenre'\n+\n+\n+class Award(Base):\n+    \"\"\"Award won by the person or for the creative work.\"\"\"\n+\n+    #: (:class:`int`) The primary key integer.\n+    id = Column(Integer, primary_key=True)\n+\n+    #: (:class:`str`) The name of the award.\n+    name = Column(String, nullable=False, index=True)\n+\n+    #: (:class:`collections.abc.MutableSet`) The set of\n+    #:  :class:`PersonAward` s that the award has.\n+    person_awards = relationship('PersonAward', collection_class=set)\n+\n+    #: (:class:`collections.abc.MutableSet`) The set of\n+    #:  :class:`cliche.people.Person` s that won the award.\n+    persons = relationship(Person,\n+                           secondary='person_awards',\n+                           collection_class=set)\n+\n+    #: (:class:`collections.abc.MutableSet`) The set of\n+    #:  :class:`WorkAward` s that the award has.\n+    work_awards = relationship('WorkAward', collection_class=set)\n+\n+    #: (:class:`collections.abc.MutableSet`) The set of\n+    #:  :class:`Work` s that won the award.\n+    works = relationship('Work',\n+                           secondary='work_awards',\n+                           collection_class=set)\n+\n+    #: (:class:`datetime.datetime`) The date and time on which\n+    #:  the record was created.\n+    created_at = Column(DateTime(timezone=True), nullable=False,\n+                        default=now())\n+\n+    __tablename__ = 'awards'\n+    __repr_columns__ = id, name\n+\n+\n+class Genre(Base):\n+    \"\"\"Genre of the creative work\"\"\"\n+\n+    #: (:class:`int`) The primary key integer.\n+    id = Column(Integer, primary_key=True)\n+\n+    #: (:class:`str`) The name of the genre.\n+    name = Column(String, nullable=False, index=True)\n+\n+    #: (:class:`collections.abc.MutableSet`) The set of\n+    #:  :class:`WorkGenre` s that the genre has.\n+    work_genres = relationship('WorkGenre', collection_class=set)\n+\n+    #: (:class:`collections.abc.MutableSet`) The set of\n+    #:  :class:`Work` s that fall into the genre.\n+    works = relationship('Work',\n+                           secondary='work_genres',\n+                           collection_class=set)\n+\n+    #: (:class:`datetime.datetime`) The date and time on which\n+    #:  the record was created.\n+    created_at = Column(DateTime(timezone=True), nullable=False,\n+                        default=now())\n+\n+    __tablename__ = 'genres'\n+    __repr_columns__ = id, name\n+\n+\n+class PersonAward(Base):\n+    \"\"\"Relationship between the person and the award\"\"\"\n+\n+    #: (:class:`int`) :class:`cliche.people.Person.id` of :attr:`person`.\n+    person_id = Column(Integer, ForeignKey(Person.id), primary_key=True)\n+\n+    #: (:class:`cliche.people.Person`) The person that won the :attr:`award`.\n+    person = relationship(Person)\n+\n+    #: (:class:`int`) :class:`Award.id` of :attr:`award`.\n+    award_id = Column(Integer, ForeignKey(Award.id), primary_key=True)\n+\n+    #: (:class:`Award`) The award that the :attr:`person` won.\n+    award = relationship(Award)\n+\n+    #: (:class:`datetime.datetime`) The date and time on which\n+    #:  the record was created.\n+    created_at = Column(DateTime(timezone=True), nullable=False,\n+                        default=now())\n+\n+    __tablename__ = 'person_awards'\n+    __repr_columns__ = person_id, award_id\n \n \n class Work(Base):\n-    \"\"\"Work i.e. Book.\"\"\"\n+    \"\"\"Creative work i.e. book.\"\"\"\n \n     #: (:class:`int`) The primary key integer.\n     id = Column(Integer, primary_key=True)\n \n-    #: (:class:`str`) Title.\n-    title = Column(String, nullable=False, index=True)\n+    #: (:class:`str`) The name of the work.\n+    name = Column(String, nullable=False, index=True)\n+\n+    #: (:class:`datetime.date`) The publication date.\n+    publication_date = Column(Date)\n \n-    #: (:class:`datetime.date`) Published date.\n-    dop = Column(Date)\n+    #: (:class:`int`) The number of pages in the book.\n+    number_of_pages = Column(Integer)\n \n-    #: (:class:`int`) Author team id.\n+    #: (:class:`str`) The ISBN of the book.\n+    isbn = Column(String)","path":"cliche/work.py","position":129,"original_position":129,"commit_id":"5b033b3d3bc7be32cfc000e92e11904e945c6157","original_commit_id":"5b033b3d3bc7be32cfc000e92e11904e945c6157","user":{"login":"sjw0687","id":8075795,"avatar_url":"https://avatars.githubusercontent.com/u/8075795?v=2","gravatar_id":"213e260ded678c6e8d7c0ea5de899bb3","url":"https://api.github.com/users/sjw0687","html_url":"https://github.com/sjw0687","followers_url":"https://api.github.com/users/sjw0687/followers","following_url":"https://api.github.com/users/sjw0687/following{/other_user}","gists_url":"https://api.github.com/users/sjw0687/gists{/gist_id}","starred_url":"https://api.github.com/users/sjw0687/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjw0687/subscriptions","organizations_url":"https://api.github.com/users/sjw0687/orgs","repos_url":"https://api.github.com/users/sjw0687/repos","events_url":"https://api.github.com/users/sjw0687/events{/privacy}","received_events_url":"https://api.github.com/users/sjw0687/received_events","type":"User","site_admin":false},"body":"Great. `ISBN13` is the good type for that in PostgreSQL. But how can I apply this to SQLAlchemy? It looks like SQLAlchemy doesn't support the types in isn module.\r\n\r\nHow about just make a custome type in pgsql?","created_at":"2014-08-12T06:24:08Z","updated_at":"2014-08-12T06:24:08Z","html_url":"https://github.com/clicheio/cliche/pull/4#discussion_r16097301","pull_request_url":"https://api.github.com/repos/clicheio/cliche/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/clicheio/cliche/pulls/comments/16097301"},"html":{"href":"https://github.com/clicheio/cliche/pull/4#discussion_r16097301"},"pull_request":{"href":"https://api.github.com/repos/clicheio/cliche/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/clicheio/cliche/pulls/4","id":19575639,"html_url":"https://github.com/clicheio/cliche/pull/4","diff_url":"https://github.com/clicheio/cliche/pull/4.diff","patch_url":"https://github.com/clicheio/cliche/pull/4.patch","issue_url":"https://api.github.com/repos/clicheio/cliche/issues/4","number":4,"state":"open","title":"add award, genre and columns to work.","user":{"login":"sjw0687","id":8075795,"avatar_url":"https://avatars.githubusercontent.com/u/8075795?v=2","gravatar_id":"213e260ded678c6e8d7c0ea5de899bb3","url":"https://api.github.com/users/sjw0687","html_url":"https://github.com/sjw0687","followers_url":"https://api.github.com/users/sjw0687/followers","following_url":"https://api.github.com/users/sjw0687/following{/other_user}","gists_url":"https://api.github.com/users/sjw0687/gists{/gist_id}","starred_url":"https://api.github.com/users/sjw0687/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjw0687/subscriptions","organizations_url":"https://api.github.com/users/sjw0687/orgs","repos_url":"https://api.github.com/users/sjw0687/repos","events_url":"https://api.github.com/users/sjw0687/events{/privacy}","received_events_url":"https://api.github.com/users/sjw0687/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-08-10T18:06:19Z","updated_at":"2014-08-12T06:24:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7c1ee8860e62d26f6b9dbb224d36eba9771d477b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/clicheio/cliche/pulls/4/commits","review_comments_url":"https://api.github.com/repos/clicheio/cliche/pulls/4/comments","review_comment_url":"https://api.github.com/repos/clicheio/cliche/pulls/comments/{number}","comments_url":"https://api.github.com/repos/clicheio/cliche/issues/4/comments","statuses_url":"https://api.github.com/repos/clicheio/cliche/statuses/5b033b3d3bc7be32cfc000e92e11904e945c6157","head":{"label":"sjw0687:work","ref":"work","sha":"5b033b3d3bc7be32cfc000e92e11904e945c6157","user":{"login":"sjw0687","id":8075795,"avatar_url":"https://avatars.githubusercontent.com/u/8075795?v=2","gravatar_id":"213e260ded678c6e8d7c0ea5de899bb3","url":"https://api.github.com/users/sjw0687","html_url":"https://github.com/sjw0687","followers_url":"https://api.github.com/users/sjw0687/followers","following_url":"https://api.github.com/users/sjw0687/following{/other_user}","gists_url":"https://api.github.com/users/sjw0687/gists{/gist_id}","starred_url":"https://api.github.com/users/sjw0687/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjw0687/subscriptions","organizations_url":"https://api.github.com/users/sjw0687/orgs","repos_url":"https://api.github.com/users/sjw0687/repos","events_url":"https://api.github.com/users/sjw0687/events{/privacy}","received_events_url":"https://api.github.com/users/sjw0687/received_events","type":"User","site_admin":false},"repo":{"id":22721590,"name":"cliche","full_name":"sjw0687/cliche","owner":{"login":"sjw0687","id":8075795,"avatar_url":"https://avatars.githubusercontent.com/u/8075795?v=2","gravatar_id":"213e260ded678c6e8d7c0ea5de899bb3","url":"https://api.github.com/users/sjw0687","html_url":"https://github.com/sjw0687","followers_url":"https://api.github.com/users/sjw0687/followers","following_url":"https://api.github.com/users/sjw0687/following{/other_user}","gists_url":"https://api.github.com/users/sjw0687/gists{/gist_id}","starred_url":"https://api.github.com/users/sjw0687/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sjw0687/subscriptions","organizations_url":"https://api.github.com/users/sjw0687/orgs","repos_url":"https://api.github.com/users/sjw0687/repos","events_url":"https://api.github.com/users/sjw0687/events{/privacy}","received_events_url":"https://api.github.com/users/sjw0687/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sjw0687/cliche","description":"Cliche is an ontology of fictional works.","fork":true,"url":"https://api.github.com/repos/sjw0687/cliche","forks_url":"https://api.github.com/repos/sjw0687/cliche/forks","keys_url":"https://api.github.com/repos/sjw0687/cliche/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sjw0687/cliche/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sjw0687/cliche/teams","hooks_url":"https://api.github.com/repos/sjw0687/cliche/hooks","issue_events_url":"https://api.github.com/repos/sjw0687/cliche/issues/events{/number}","events_url":"https://api.github.com/repos/sjw0687/cliche/events","assignees_url":"https://api.github.com/repos/sjw0687/cliche/assignees{/user}","branches_url":"https://api.github.com/repos/sjw0687/cliche/branches{/branch}","tags_url":"https://api.github.com/repos/sjw0687/cliche/tags","blobs_url":"https://api.github.com/repos/sjw0687/cliche/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sjw0687/cliche/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sjw0687/cliche/git/refs{/sha}","trees_url":"https://api.github.com/repos/sjw0687/cliche/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sjw0687/cliche/statuses/{sha}","languages_url":"https://api.github.com/repos/sjw0687/cliche/languages","stargazers_url":"https://api.github.com/repos/sjw0687/cliche/stargazers","contributors_url":"https://api.github.com/repos/sjw0687/cliche/contributors","subscribers_url":"https://api.github.com/repos/sjw0687/cliche/subscribers","subscription_url":"https://api.github.com/repos/sjw0687/cliche/subscription","commits_url":"https://api.github.com/repos/sjw0687/cliche/commits{/sha}","git_commits_url":"https://api.github.com/repos/sjw0687/cliche/git/commits{/sha}","comments_url":"https://api.github.com/repos/sjw0687/cliche/comments{/number}","issue_comment_url":"https://api.github.com/repos/sjw0687/cliche/issues/comments/{number}","contents_url":"https://api.github.com/repos/sjw0687/cliche/contents/{+path}","compare_url":"https://api.github.com/repos/sjw0687/cliche/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sjw0687/cliche/merges","archive_url":"https://api.github.com/repos/sjw0687/cliche/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sjw0687/cliche/downloads","issues_url":"https://api.github.com/repos/sjw0687/cliche/issues{/number}","pulls_url":"https://api.github.com/repos/sjw0687/cliche/pulls{/number}","milestones_url":"https://api.github.com/repos/sjw0687/cliche/milestones{/number}","notifications_url":"https://api.github.com/repos/sjw0687/cliche/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sjw0687/cliche/labels{/name}","releases_url":"https://api.github.com/repos/sjw0687/cliche/releases{/id}","created_at":"2014-08-07T13:06:17Z","updated_at":"2014-08-08T07:31:49Z","pushed_at":"2014-08-10T18:00:01Z","git_url":"git://github.com/sjw0687/cliche.git","ssh_url":"git@github.com:sjw0687/cliche.git","clone_url":"https://github.com/sjw0687/cliche.git","svn_url":"https://github.com/sjw0687/cliche","homepage":null,"size":275,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"clicheio:master","ref":"master","sha":"73025892a6590000f2bafc05ef6f2f30cbb51052","user":{"login":"clicheio","id":8352375,"avatar_url":"https://avatars.githubusercontent.com/u/8352375?v=2","gravatar_id":null,"url":"https://api.github.com/users/clicheio","html_url":"https://github.com/clicheio","followers_url":"https://api.github.com/users/clicheio/followers","following_url":"https://api.github.com/users/clicheio/following{/other_user}","gists_url":"https://api.github.com/users/clicheio/gists{/gist_id}","starred_url":"https://api.github.com/users/clicheio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clicheio/subscriptions","organizations_url":"https://api.github.com/users/clicheio/orgs","repos_url":"https://api.github.com/users/clicheio/repos","events_url":"https://api.github.com/users/clicheio/events{/privacy}","received_events_url":"https://api.github.com/users/clicheio/received_events","type":"Organization","site_admin":false},"repo":{"id":22606614,"name":"cliche","full_name":"clicheio/cliche","owner":{"login":"clicheio","id":8352375,"avatar_url":"https://avatars.githubusercontent.com/u/8352375?v=2","gravatar_id":null,"url":"https://api.github.com/users/clicheio","html_url":"https://github.com/clicheio","followers_url":"https://api.github.com/users/clicheio/followers","following_url":"https://api.github.com/users/clicheio/following{/other_user}","gists_url":"https://api.github.com/users/clicheio/gists{/gist_id}","starred_url":"https://api.github.com/users/clicheio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clicheio/subscriptions","organizations_url":"https://api.github.com/users/clicheio/orgs","repos_url":"https://api.github.com/users/clicheio/repos","events_url":"https://api.github.com/users/clicheio/events{/privacy}","received_events_url":"https://api.github.com/users/clicheio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/clicheio/cliche","description":"Cliche is an ontology of fictional works.","fork":false,"url":"https://api.github.com/repos/clicheio/cliche","forks_url":"https://api.github.com/repos/clicheio/cliche/forks","keys_url":"https://api.github.com/repos/clicheio/cliche/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clicheio/cliche/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clicheio/cliche/teams","hooks_url":"https://api.github.com/repos/clicheio/cliche/hooks","issue_events_url":"https://api.github.com/repos/clicheio/cliche/issues/events{/number}","events_url":"https://api.github.com/repos/clicheio/cliche/events","assignees_url":"https://api.github.com/repos/clicheio/cliche/assignees{/user}","branches_url":"https://api.github.com/repos/clicheio/cliche/branches{/branch}","tags_url":"https://api.github.com/repos/clicheio/cliche/tags","blobs_url":"https://api.github.com/repos/clicheio/cliche/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clicheio/cliche/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clicheio/cliche/git/refs{/sha}","trees_url":"https://api.github.com/repos/clicheio/cliche/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clicheio/cliche/statuses/{sha}","languages_url":"https://api.github.com/repos/clicheio/cliche/languages","stargazers_url":"https://api.github.com/repos/clicheio/cliche/stargazers","contributors_url":"https://api.github.com/repos/clicheio/cliche/contributors","subscribers_url":"https://api.github.com/repos/clicheio/cliche/subscribers","subscription_url":"https://api.github.com/repos/clicheio/cliche/subscription","commits_url":"https://api.github.com/repos/clicheio/cliche/commits{/sha}","git_commits_url":"https://api.github.com/repos/clicheio/cliche/git/commits{/sha}","comments_url":"https://api.github.com/repos/clicheio/cliche/comments{/number}","issue_comment_url":"https://api.github.com/repos/clicheio/cliche/issues/comments/{number}","contents_url":"https://api.github.com/repos/clicheio/cliche/contents/{+path}","compare_url":"https://api.github.com/repos/clicheio/cliche/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clicheio/cliche/merges","archive_url":"https://api.github.com/repos/clicheio/cliche/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clicheio/cliche/downloads","issues_url":"https://api.github.com/repos/clicheio/cliche/issues{/number}","pulls_url":"https://api.github.com/repos/clicheio/cliche/pulls{/number}","milestones_url":"https://api.github.com/repos/clicheio/cliche/milestones{/number}","notifications_url":"https://api.github.com/repos/clicheio/cliche/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clicheio/cliche/labels{/name}","releases_url":"https://api.github.com/repos/clicheio/cliche/releases{/id}","created_at":"2014-08-04T14:12:58Z","updated_at":"2014-08-10T18:00:40Z","pushed_at":"2014-08-08T16:21:32Z","git_url":"git://github.com/clicheio/cliche.git","ssh_url":"git@github.com:clicheio/cliche.git","clone_url":"https://github.com/clicheio/cliche.git","svn_url":"https://github.com/clicheio/cliche","homepage":"http://cliche.io/","size":454,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"forks_count":4,"mirror_url":null,"open_issues_count":2,"forks":4,"open_issues":2,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/clicheio/cliche/pulls/4"},"html":{"href":"https://github.com/clicheio/cliche/pull/4"},"issue":{"href":"https://api.github.com/repos/clicheio/cliche/issues/4"},"comments":{"href":"https://api.github.com/repos/clicheio/cliche/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/clicheio/cliche/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/clicheio/cliche/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/clicheio/cliche/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/clicheio/cliche/statuses/5b033b3d3bc7be32cfc000e92e11904e945c6157"}}}}