Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Experiment in understanding different ways to do ManyToManyFields

tree: c0d09d8597

Fetching latest commit…

Cannot retrieve the latest commit at this time

README
Uh???
-----

Two django seniors trying to get to grips with basic many to many
fields.


Tables
------

To inspect the created tables use:

        ./manage.py syncdb --settings=settings_persistent
        sqlite3 many2many.db

        sqlite> .tables appvers%
        appversions1_appversion        appversions2_appversion2
        appversions1_appversion_trees  appversions2_throughtree2
        appversions1_throughtree


Tables Explained
-----------------
tree
- - -

sqlite> .schema life_tree
CREATE TABLE "life_tree" (
    "id" integer NOT NULL PRIMARY KEY,
    "code" varchar(10) NOT NULL
);


appversions1
- - - - - - -

sqlite> .schema appversions1_appversion
CREATE TABLE "appversions1_appversion" (
    "id" integer NOT NULL PRIMARY KEY,
    "code" varchar(10) NOT NULL
);
sqlite> .schema appversions1_appversion_trees
CREATE TABLE "appversions1_appversion_trees" (
    "id" integer NOT NULL PRIMARY KEY,
    "appversion_id" integer NOT NULL,
    "throughtree_id" integer NOT NULL REFERENCES "appversions1_throughtree" ("id"),
    UNIQUE ("appversion_id", "throughtree_id")
);
CREATE INDEX "appversions1_appversion_trees_3d278d29" ON "appversions1_appversion_trees" ("appversion_id");
CREATE INDEX "appversions1_appversion_trees_77fc41e4" ON "appversions1_appversion_trees" ("throughtree_id");
sqlite> .schema appversions1_throughtree
CREATE TABLE "appversions1_throughtree" (
    "id" integer NOT NULL PRIMARY KEY,
    "start" datetime NOT NULL,
    "end" datetime NOT NULL,
    "tree_id" integer NOT NULL REFERENCES "life_tree" ("id")
);
CREATE INDEX "appversions1_throughtree_efd07f28" ON "appversions1_throughtree" ("tree_id");


appversions2
- - - - - - -

sqlite> .schema appversions2_appversion2
CREATE TABLE "appversions2_appversion2" (
    "id" integer NOT NULL PRIMARY KEY,
    "code" varchar(10) NOT NULL
);
sqlite> .schema appversions2_throughtree2
CREATE TABLE "appversions2_throughtree2" (
    "id" integer NOT NULL PRIMARY KEY,
    "start" datetime NOT NULL,
    "end" datetime NOT NULL,
    "appversion_id" integer NOT NULL REFERENCES "appversions2_appversion2" ("id"),
    "tree_id" integer NOT NULL REFERENCES "life_tree" ("id")
);
CREATE INDEX "appversions2_throughtree2_3d278d29" ON "appversions2_throughtree2" ("appversion_id");
CREATE INDEX "appversions2_throughtree2_efd07f28" ON "appversions2_throughtree2" ("tree_id");
Something went wrong with that request. Please try again.