Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PRAGMA foreign_keys = ON;
- DROP TABLE if exists user;
- CREATE TABLE user (
- id INTEGER PRIMARY KEY autoincrement,
- username TEXT NOT NULL,
- password TEXT NOT NULL,
- first_name TEXT,
- last_name TEXT,
- birth_date DATE,
- CHECK (
- length("birth_date") = 10
- )
- );
- DROP TABLE if exists post;
- CREATE TABLE post (
- id INTEGER PRIMARY KEY autoincrement,
- user_id INTEGER,
- created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
- content TEXT NOT NULL,
- FOREIGN KEY(user_id) REFERENCES user(id),
- CHECK(
- typeof("content") = "text" AND
- length("content") <= 140
- )
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement