miniflux-legacy/schema.php

68 lines
1.3 KiB
PHP
Raw Normal View History

2013-02-18 03:48:21 +01:00
<?php
namespace Schema;
2013-05-21 12:25:13 +02:00
2013-05-18 20:35:16 +02:00
function version_5($pdo)
{
$pdo->exec('ALTER TABLE feeds ADD COLUMN last_checked INTEGER');
}
2013-05-21 12:25:13 +02:00
2013-04-23 04:41:20 +02:00
function version_4($pdo)
{
$pdo->exec("CREATE INDEX idx_status ON items(status)");
}
2013-04-13 03:08:55 +02:00
function version_3($pdo)
{
$pdo->exec("ALTER TABLE config ADD COLUMN language TEXT DEFAULT 'en_US'");
}
function version_2($pdo)
{
$pdo->exec('ALTER TABLE feeds ADD COLUMN last_modified TEXT');
$pdo->exec('ALTER TABLE feeds ADD COLUMN etag TEXT');
}
2013-02-18 03:48:21 +01:00
function version_1($pdo)
{
$pdo->exec("
CREATE TABLE config (
username TEXT DEFAULT 'admin',
password TEXT
2013-02-18 03:48:21 +01:00
)
");
$pdo->exec("
INSERT INTO config
(password)
VALUES ('".\password_hash('admin', PASSWORD_BCRYPT)."')
2013-02-18 03:48:21 +01:00
");
$pdo->exec('
CREATE TABLE feeds (
id INTEGER PRIMARY KEY,
site_url TEXT,
feed_url TEXT UNIQUE,
title TEXT
)
');
$pdo->exec('
CREATE TABLE items (
id TEXT PRIMARY KEY,
url TEXT,
title TEXT,
author TEXT,
content TEXT,
updated TEXT,
status TEXT,
feed_id INTEGER,
FOREIGN KEY(feed_id) REFERENCES feeds(id) ON DELETE CASCADE
)
');
}