mirror of
https://github.com/Cernobor/oko-server.git
synced 2025-02-24 08:27:17 +00:00
* errors put into separate package * added table to store feature photos * added API endpoints for serving photos * POST /data extended to accept photos using a multipart/form-data body
24 lines
692 B
SQL
24 lines
692 B
SQL
DROP TABLE IF EXISTS users;
|
|
CREATE TABLE IF NOT EXISTS users (
|
|
id integer PRIMARY KEY AUTOINCREMENT,
|
|
name text NOT NULL UNIQUE
|
|
);
|
|
INSERT INTO users(id, name) VALUES(0, 'system');
|
|
|
|
DROP TABLE IF EXISTS features;
|
|
CREATE TABLE IF NOT EXISTS features (
|
|
id integer PRIMARY KEY AUTOINCREMENT,
|
|
owner_id integer REFERENCES users(id) ON DELETE CASCADE,
|
|
name text NOT NULL,
|
|
description text,
|
|
category text,
|
|
geom text NOT NULL
|
|
);
|
|
|
|
DROP TABLE IF EXISTS feature_photos;
|
|
CREATE TABLE IF NOT EXISTS feature_photos (
|
|
id integer PRIMARY KEY AUTOINCREMENT,
|
|
feature_id integer NOT NULL REFERENCES features(id) ON DELETE CASCADE,
|
|
content_type text NOT NULL,
|
|
file_contents blob NOT NULL
|
|
); |