Monday, September 21, 2015

Re: CAKE 3.0 Tutorials using SQLITE

This seems to work for the bookmarks app in SQLITE. ( Except for a cascadeing delete).

CREATE TABLE "users" (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"email" text NOT NULL,
"password" text NOT NULL,
"created" text,
"modified" text
);

CREATE TABLE "bookmarks" (
  "id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  "user_id" integer NOT NULL,
  "title" text NULL,
  "description" text NULL,
  "url" text NULL,
  "created" text NULL,
  "modified" text NULL,
  FOREIGN KEY ("user_id") REFERENCES "users" ("id")
);

CREATE TABLE "bookmarks_tags" (
"bookmark_id" integer NOT NULL,
"tag_id" integer NOT NULL,
PRIMARY KEY (bookmark_id, tag_id),
FOREIGN KEY (tag_id) REFERENCES tags(id),
FOREIGN KEY (bookmark_id) REFERENCES bookmarks(id)
);

CREATE TABLE "tags" (
"id" integer NOT NULL PRIMARY KEY AUTOINCREMENT,
"title" text NOT NULL UNIQUE,
"created" text,
"modified" text
);

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.

No comments: