SQLite3 database schema

Next, we need to make sure that our database is configured. We're using this SQL table definition for the schema (save this as models/schema-sqlite3.sql):

CREATE TABLE IF NOT EXISTS notes (    notekey VARCHAR(255),    title VARCHAR(255),    body TEXT);

How do we initialize this schema before writing some code? One way is to ensure that the sqlite3 package is installed through your operating system package management system, such as using apt-get on Ubuntu/Debian, and MacPorts on macOS. Once it's installed, you can run the following command:

$ sqlite3 chap07.sqlite3 SQLite version 3.21.0 2017-10-24 18:55:49Enter ".help" for usage hints.sqlite> CREATE TABLE IF NOT EXISTS notes (   ...> notekey VARCHAR(255), ...> title VARCHAR(255), ...

Get Node.js Web Development - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.