GardenPlanner/api/init.sql

113 lines
4.8 KiB
SQL

-- CREATE TABLE
CREATE TABLE IF NOT EXISTS plants (
id SERIAL PRIMARY KEY,
name VARCHAR(255),
description VARCHAR(255),
water_requirement REAL,
horizontal_space REAL,
vertical_space REAL,
image_path VARCHAR(255)
);
CREATE TABLE IF NOT EXISTS plant_times (
id SERIAL PRIMARY KEY,
plant_id INTEGER,
color VARCHAR(255),
description VARCHAR(255),
from_date DATE,
until_date DATE,
action_needed boolean,
FOREIGN KEY (plant_id) REFERENCES plants (id) ON DELETE CASCADE
);
CREATE TABLE IF NOT EXISTS beets (
id SERIAL PRIMARY KEY,
plant_id INTEGER,
position INTEGER,
beet_row INTEGER,
FOREIGN KEY (plant_id) REFERENCES plants (id) ON DELETE CASCADE
);
INSERT INTO plants (name, description, horizontal_space, vertical_space, water_requirement, image_path)
VALUES
('Tomate', '', 0.6, 0.8, 0.8, 'lib/assets/plants/tomatoes-gc17bf34c6_640.jpg'),
('Kopfsalat', 'Maikönig', 0.25, 0.25, 0.5, 'lib/assets/plants/salad-seedling-g46a52dd37_640.jpg'),
('Radieschen', '', 0.15, 0.2, 0.4, 'lib/assets/plants/root-g27af04562_640.jpg'),
('Himbeere', 'Nugana', 0.4, 0.6, 0.9, 'lib/assets/plants/raspberries-ge56ab3ffc_640.jpg'),
('Himbeere', 'Glen Ample', 0.4, 0.6, 0.9, 'lib/assets/plants/raspberries-gce73a006c_640.jpg'),
('Jostabeere', '', 2.5, 2.5, 1.2, 'lib/assets/plants/jostaberry-gdf8566383_640.jpg'),
('Johannisbeere', '', 0.4, 0.6, 0.8, 'lib/assets/plants/currant-geaf055095_640.jpg'),
('Brombeere', 'Navaho', 1, 1, 1.1, 'lib/assets/plants/blackberries-gae933f2d8_640.jpg'),
('Karotte', '', 0.15, 0.2, 0.7, 'lib/assets/plants/carrot.jpg'),
('Gurke', '', 0.4, 0.6, 0.6, 'lib/assets/plants/cucumber.jpg'),
('Paprika', '', 0.3, 0.3, 0.5, 'lib/assets/plants/pepper.jpg'),
('Erdbeere', '', 0.3, 0.3, 0.8, 'lib/assets/plants/strawberry.jpg'),
('Basilikum', '', 0.2, 0.2, 0.3, 'lib/assets/plants/basil.jpg');
INSERT INTO plant_times (plant_id, from_date, until_date, description, action_needed, color)
VALUES
-- Tomate
(1, '2023-04-01', '2023-05-15', 'Aussaat', TRUE, '4294961979'),
(1, '2023-05-15', '2023-06-15', 'Wachstumsphase', FALSE, '438858537'),
(1, '2023-06-15', '2023-07-31', 'Erntezeit', FALSE, '4294198070'),
-- Kopfsalat
(2, '2023-04-01', '2023-06-01', 'Aussaat', TRUE, '4294961979'),
(2, '2023-06-01', '2023-07-15', 'Wachstumsphase', FALSE, '438858537'),
(2, '2023-07-15', '2023-08-31', 'Erntezeit', FALSE, '4294198070'),
-- Radieschen
(3, '2023-03-15', '2023-05-01', 'Aussaat', TRUE, '4294961979'),
(3, '2023-05-01', '2023-06-15', 'Wachstumsphase', FALSE, '438858537'),
(3, '2023-06-15', '2023-07-31', 'Erntezeit', FALSE, '4294198070'),
-- Himbeere (Nugana)
(4, '2023-04-15', '2023-05-31', 'Aussaat', TRUE, '4294961979'),
(4, '2023-05-31', '2023-07-15', 'Wachstumsphase', FALSE, '438858537'),
(4, '2023-07-15', '2023-08-31', 'Erntezeit', FALSE, '4294198070'),
-- Himbeere (Glen Ample)
(5, '2023-04-15', '2023-05-31', 'Aussaat', TRUE, '4294961979'),
(5, '2023-05-31', '2023-07-15', 'Wachstumsphase', FALSE, '438858537'),
(5, '2023-07-15', '2023-08-31', 'Erntezeit', FALSE, '4294198070'),
-- Jostabeere
(6, '2023-03-01', '2023-05-01', 'Aussaat', TRUE, '4294961979'),
(6, '2023-05-01', '2023-07-01', 'Wachstumsphase', FALSE, '438858537'),
(6, '2023-07-01', '2023-09-15', 'Erntezeit', FALSE, '4294198070'),
-- Johannisbeere
(7, '2023-03-15', '2023-05-01', 'Aussaat', TRUE, '4294961979'),
(7, '2023-05-01', '2023-07-01', 'Wachstumsphase', FALSE, '438858537'),
(7, '2023-07-01', '2023-08-31', 'Erntezeit', FALSE, '4294198070'),
-- Brombeere (Navaho)
(8, '2023-04-15', '2023-06-01', 'Aussaat', TRUE, '4294961979'),
(8, '2023-06-01', '2023-07-31', 'Wachstumsphase', FALSE, '438858537'),
(8, '2023-07-31', '2023-09-30', 'Erntezeit', FALSE, '4294198070'),
-- Karotte
(9, '2023-04-01', '2023-05-15', 'Aussaat', TRUE, '4294961979'),
(9, '2023-05-15', '2023-07-01', 'Wachstumsphase', FALSE, '438858537'),
(9, '2023-07-01', '2023-08-31', 'Erntezeit', FALSE, '4294198070'),
-- Gurke
(10, '2023-04-15', '2023-06-01', 'Aussaat', TRUE, '4294961979'),
(10, '2023-06-01', '2023-08-01', 'Wachstumsphase', FALSE, '438858537'),
(10, '2023-08-01', '2023-09-30', 'Erntezeit', FALSE, '4294198070'),
-- Paprika
(11, '2023-03-15', '2023-05-15', 'Aussaat', TRUE, '4294961979'),
(11, '2023-05-15', '2023-07-01', 'Wachstumsphase', FALSE, '438858537'),
(11, '2023-07-01', '2023-09-30', 'Erntezeit', FALSE, '4294198070'),
-- Erdbeere
(12, '2023-03-01', '2023-05-01', 'Aussaat', TRUE, '4294961979'),
(12, '2023-05-01', '2023-07-01', 'Wachstumsphase', FALSE, '438858537'),
(12, '2023-07-01', '2023-08-31', 'Erntezeit', FALSE, '4294198070'),
-- Basilikum
(13, '2023-03-15', '2023-04-30', 'Aussaat', TRUE, '4294961979'),
(13, '2023-04-30', '2023-06-15', 'Wachstumsphase', FALSE, '438858537'),
(13, '2023-06-15', '2023-08-15', 'Erntezeit', FALSE, '4294198070');