schema.sql
This file
Path
examples/tutorial/flaskr/schema.sql
20 lines · 498 bytes · SQL
Last changed by
Not known.
History of this fileTake it
The walk stopped after 200 commits: lines older than ab6e630 point at it.
Merge branch '1.1.x'David Lordbefore adoptionab6e630
lines 1–20why, one step back1-- Initialize the database.2-- Drop any existing data and create empty tables.34DROP TABLE IF EXISTS user;5DROP TABLE IF EXISTS post;67CREATE TABLE user (8 id INTEGER PRIMARY KEY AUTOINCREMENT,9 username TEXT UNIQUE NOT NULL,10 password TEXT NOT NULL11);1213CREATE TABLE post (14 id INTEGER PRIMARY KEY AUTOINCREMENT,15 author_id INTEGER NOT NULL,16 created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,17 title TEXT NOT NULL,18 body TEXT NOT NULL,19 FOREIGN KEY (author_id) REFERENCES user (id)20);