Advertisement
Guest User

Untitled

a guest
Sep 20th, 2014
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. class Story(models.Model):
  4. #story_id =
  5. story_name = models.CharField(unique=False, max_length=255)
  6. story_description = models.TextField()
  7. story_trailer = models.CharField(unique=False, max_length=255)
  8.  
  9. class Meta:
  10. db_table = 'story'
  11.  
  12. def __unicode__(self):
  13. return self.story_name
  14.  
  15.  
  16. class Pool(models.Model):
  17. transition_text = models.TextField()
  18. pool_sequence_nr = models.IntegerField(unique=False)
  19. story = models.ForeignKey('Story')
  20.  
  21. class Meta:
  22. db_table = 'pool'
  23.  
  24. def __unicode__(self):
  25. return self.pool_sequence_nr
  26.  
  27.  
  28. class Video(models.Model):
  29. video_name = models.CharField(unique=False, max_length=255)
  30. video_url = models.CharField(unique=False, max_length=255)
  31. pool = models.ForeignKey('Pool')
  32.  
  33. class Meta:
  34. db_table = 'video'
  35.  
  36. def __unicode__(self):
  37. return self.video_name
  38.  
  39.  
  40. class Place(models.Model):
  41. #place_id
  42. place_name = models.CharField(unique=False, max_length=255)
  43. beacon_id = models.CharField(unique=False, max_length=255)
  44. video = models.ForeignKey('Video')
  45.  
  46. class Meta:
  47. db_table = 'place'
  48.  
  49. def __unicode__(self):
  50. return self.place_name
  51.  
  52.  
  53. class Comment(models.Model):
  54. comment_username = models.CharField(unique=False, max_length=255)
  55. comment_text = models.TextField()
  56. place = models.ForeignKey('Place')
  57.  
  58. class Meta:
  59. db_table = 'comment'
  60.  
  61. def __unicode__(self):
  62. return self.comment_username
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. CREATE TABLE story (
  74. story_id INT PRIMARY KEY AUTO_INCREMENT,
  75. story_name VARCHAR(40) NOT NULL,
  76. story_description VARCHAR(255) NOT NULL
  77. );
  78.  
  79. CREATE TABLE pool (
  80. pool_id INT PRIMARY KEY AUTO_INCREMENT,
  81. transition VARCHAR(255) NOT NULL,
  82. sequence_nr INT NOT NULL,
  83. story INT NOT NULL,
  84. FOREIGN KEY (story) REFERENCES story(story_id) ON DELETE CASCADE ON UPDATE CASCADE
  85. );
  86.  
  87. CREATE TABLE video (
  88. video_id INT PRIMARY KEY AUTO_INCREMENT,
  89. name VARCHAR(40) NOT NULL,
  90. url VARCHAR(255) NOT NULL,
  91. pool INT NOT NULL REFERENCES pool(pool_id)
  92. );
  93.  
  94. CREATE TABLE place (
  95. place_id INT PRIMARY KEY AUTO_INCREMENT,
  96. name VARCHAR(40) NOT NULL,
  97. latitude FLOAT(11,8) NOT NULL,
  98. longitude FLOAT(11,8) NOT NULL,
  99. radius FLOAT(4,2) NOT NULL,
  100. video INT NOT NULL REFERENCES video(video_id)
  101. );
  102.  
  103. CREATE TABLE comment (
  104. comment_id INT PRIMARY KEY AUTO_INCREMENT,
  105. user VARCHAR(40) NOT NULL,
  106. content VARCHAR(255) NOT NULL,
  107. place INT NOT NULL REFERENCES place(place_id)
  108. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement