Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify current models to match sql schema #117

Closed
wants to merge 3 commits into from

Conversation

dbrgn
Copy link
Member

@dbrgn dbrgn commented Apr 22, 2014

See #79

@dbrgn dbrgn added this to the Iteration 5 milestone Apr 16, 2014
- New django app in `apps/swid`
- Model definitions in `models.py`
- Admin configuration in `admin.py`
@dbrgn dbrgn self-assigned this Apr 21, 2014
@dbrgn
Copy link
Member Author

dbrgn commented Apr 22, 2014

Oops, I accidentally the internet created this PR against master, not futuremaster. Ignore the first (swid app) commit.

@dbrgn
Copy link
Member Author

dbrgn commented Apr 22, 2014

Add label to components:

BEGIN TRANSACTION;
DROP TABLE components;
CREATE TABLE "components" (
    "id" integer NOT NULL PRIMARY KEY,
    "vendor_id" integer NOT NULL,
    "name" integer NOT NULL,
    "qualifier" integer NOT NULL,
    "label" varchar(255) NOT NULL
);
COMMIT;

Add trusted flag:

BEGIN TRANSACTION;
CREATE TABLE devices_backup(id, description, value, product, created);
INSERT INTO devices_backup SELECT * FROM devices;
DROP TABLE devices;
CREATE TABLE devices (
    "id" integer NOT NULL PRIMARY KEY,
    "value" varchar(255) NOT NULL,
    "description" text,
    "product" integer NOT NULL REFERENCES "products" ("id"),
    "trusted" integer NOT NULL,
    "created" integer
);
CREATE INDEX "devices_f6915675" ON "devices" ("value");
CREATE INDEX "devices_7f1b40ad" ON "devices" ("product");
INSERT INTO devices SELECT id, value, description, product, 1, created FROM devices_backup;
DROP TABLE devices_backup;
COMMIT;

@dbrgn dbrgn assigned d22 and unassigned dbrgn Apr 22, 2014
@dbrgn
Copy link
Member Author

dbrgn commented Apr 22, 2014

Ready for review, @d22 :)

@dbrgn dbrgn added the review label Apr 22, 2014
@@ -28,7 +28,7 @@

class TncappTest(TestCase):
def setUp(self):
user = Identity.objects.create(data='Test User')
user = Identity.objects.create(data='Test User', type=5)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to type=1 and remove next line?

- Compared models with SQL schema in strongSwan sourcecode
- Made changes to be compatible with that reference schema

The goal is that the schema can be generated by django in the future.
The main advantage of that is that we can generate the schema for
different database backends.
It is now possible to view, add and edit data from all tables using the
django admin interface.
@dbrgn
Copy link
Member Author

dbrgn commented Apr 22, 2014

Merged in branch futuremaster.

@dbrgn dbrgn closed this Apr 22, 2014
@dbrgn dbrgn deleted the issue117-modify-models branch April 22, 2014 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants