Last active
May 10, 2016 10:06
-
-
Save akki/56b6c3cac56073c9bf4d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#model | |
class Student(models.Model): | |
name = models.CharField(max_length=200, db_index=True, unique=True) | |
branch = models.CharField(max_length=20, db_index=True) | |
college = models.CharField(max_length=100, unique=True) | |
year = models.CharField(max_length=100) | |
def __unicode__(self): | |
return self.name | |
# sqlmigrate gives the following output for the above model | |
''' | |
BEGIN; | |
-- | |
-- Create model Student | |
-- | |
CREATE TABLE "qwe_student" ("id" serial NOT NULL PRIMARY KEY, "name" varchar(200) NOT NULL UNIQUE, "branch" varchar(20) NOT NULL, "college" varchar(100) NOT NULL UNIQUE, "year" varchar(100) NOT NULL); | |
CREATE INDEX "qwe_student_9603a224" ON "qwe_student" ("branch"); | |
CREATE INDEX "qwe_student_name_f12973df_like" ON "qwe_student" ("name" varchar_pattern_ops); | |
CREATE INDEX "qwe_student_branch_21d799ac_like" ON "qwe_student" ("branch" varchar_pattern_ops); | |
CREATE INDEX "qwe_student_college_5063f3ca_like" ON "qwe_student" ("college" varchar_pattern_ops); | |
COMMIT; | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment