package storage

const Migrations = `
CREATE TABLE IF NOT EXISTS posts(
	id INTEGER PRIMARY KEY AUTOINCREMENT,	
	title TEXT NOT NULL,
	published BOOLEAN DEFAULT 0,
	content TEXT NOT NULL,
	CREATED_AT DATETIME DEFAULT CURRENT_TIMESTAMP,
	updated_at DATETIME,
	tags TEXT
);

CREATE TABLE IF NOT EXISTS users(
	id INTEGER PRIMARY KEY AUTOINCREMENT,
	email TEXT,
	github_id INTEGER,
	github_login TEXT,
	avatar_url TEXT
);

CREATE TABLE IF NOT EXISTS comments(
	id INTEGER PRIMARY KEY AUTOINCREMENT,
	post_id INTEGER NOT NULL,
	user_id INTEGER,
	content TEXT NOT NULL,
	created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
	FOREIGN KEY (post_id) REFERENCES posts(id),
	FOREIGN KEY (user_id) REFERENCES users(id)
);
`
