Skip to content

Instantly share code, notes, and snippets.

@clayrichardson
Created June 29, 2013 00:40
Show Gist options
  • Save clayrichardson/5889146 to your computer and use it in GitHub Desktop.
Save clayrichardson/5889146 to your computer and use it in GitHub Desktop.
from django.db import models
class Manufacturer(models.Model):
uuid = models.CharField(max_length = 100)
name = models.CharField(max_length = 100)
class Car(models.Model):
uuid = models.CharField(max_length = 100)
manufacturer = models.ForeignKey(Manufacturer)
BEGIN;
CREATE TABLE "api_manufacturer" (
"id" integer NOT NULL PRIMARY KEY,
"uuid" varchar(100) NOT NULL,
"name" varchar(100) NOT NULL
)
;
CREATE TABLE "api_car" (
"id" integer NOT NULL PRIMARY KEY,
"uuid" varchar(100) NOT NULL,
"manufacturer_id" integer NOT NULL REFERENCES "api_manufacturer" ("id")
)
;
CREATE INDEX "api_car_773c34af" ON "api_car" ("manufacturer_id");
COMMIT;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment