LoFa
Add
Login
Search
Title:
Tag1 for Path:
a single word in lower characters
Tag2 for Path:
List of alternative single tags:
one or many words in lower characters, separated by comma or space
Text:
<pre> from django.db import models class Country(models.Model): country_iso = models.CharField(max_length=2, primary_key=True) country_iso3 = models.CharField(max_length=3, unique=True ) country_name = models.CharField(max_length=80) # old country_print_name continent_code = models.CharField(max_length=2) class Meta: managed = True db_table = 'gc_country' </pre> <code>python3.6 manage.py makemigrations location</code> <pre> Migrations for 'location': location/migrations/0001_initial.py - Create model Country </pre> <code>python3.6 manage.py sqlmigrate location 0001</code> <pre> BEGIN; -- -- Create model Country -- CREATE TABLE "gc_country" ("country_iso" varchar(2) NOT NULL PRIMARY KEY, "country_iso3" varchar(3) NOT NULL UNIQUE, "country_name" varchar(80) NOT NULL, "continent_code" varchar(2) NOT NULL); CREATE INDEX "gc_country_country_iso_104d061b_like" ON "gc_country" ("country_iso" varchar_pattern_ops); CREATE INDEX "gc_country_country_iso3_86f72382_like" ON "gc_country" ("country_iso3" varchar_pattern_ops); COMMIT; </pre>
URL:
Operation:
Delete
Update
Insert
Template Prompt