mirror of https://github.com/Budibase/budibase.git
committed by
GitHub
7 changed files with 117 additions and 30 deletions
@ -0,0 +1,28 @@ |
|||
version: "3.8" |
|||
services: |
|||
db: |
|||
container_name: postgres-vehicle |
|||
image: postgres |
|||
restart: always |
|||
environment: |
|||
POSTGRES_USER: root |
|||
POSTGRES_PASSWORD: root |
|||
POSTGRES_DB: main |
|||
ports: |
|||
- "5432:5432" |
|||
volumes: |
|||
#- pg_data:/var/lib/postgresql/data/ |
|||
- ./init.sql:/docker-entrypoint-initdb.d/init.sql |
|||
|
|||
pgadmin: |
|||
container_name: pgadmin |
|||
image: dpage/pgadmin4 |
|||
restart: always |
|||
environment: |
|||
PGADMIN_DEFAULT_EMAIL: root@root.com |
|||
PGADMIN_DEFAULT_PASSWORD: root |
|||
ports: |
|||
- "5050:80" |
|||
|
|||
#volumes: |
|||
# pg_data: |
|||
@ -0,0 +1,52 @@ |
|||
SELECT 'CREATE DATABASE main' |
|||
WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'main')\gexec |
|||
CREATE TABLE Vehicles ( |
|||
id bigint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 9223372036854775807 CACHE 1 ), |
|||
Registration text COLLATE pg_catalog."default", |
|||
Make text COLLATE pg_catalog."default", |
|||
Model text COLLATE pg_catalog."default", |
|||
Colour text COLLATE pg_catalog."default", |
|||
Year smallint, |
|||
CONSTRAINT Vehicles_pkey PRIMARY KEY (id) |
|||
); |
|||
|
|||
CREATE TABLE ServiceLog ( |
|||
id bigint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 9223372036854775807 CACHE 1 ), |
|||
Description text COLLATE pg_catalog."default", |
|||
VehicleId bigint, |
|||
ServiceDate timestamp without time zone, |
|||
Category text COLLATE pg_catalog."default", |
|||
Mileage bigint, |
|||
CONSTRAINT ServiceLog_pkey PRIMARY KEY (id), |
|||
CONSTRAINT vehicle_foreign_key FOREIGN KEY (VehicleId) |
|||
REFERENCES Vehicles (id) MATCH SIMPLE |
|||
ON UPDATE NO ACTION |
|||
ON DELETE NO ACTION |
|||
); |
|||
|
|||
INSERT INTO Vehicles (Registration, Make, Model, Colour, Year) |
|||
VALUES ('FAZ 9837','Volkswagen','Polo','White',2002); |
|||
INSERT INTO Vehicles (Registration, Make, Model, Colour, Year) |
|||
VALUES ('JHI 8827','BMW','M3','Black',2013); |
|||
INSERT INTO Vehicles (Registration, Make, Model, Colour, Year) |
|||
VALUES ('D903PI','Volvo','XC40','Grey',2014); |
|||
INSERT INTO Vehicles (Registration, Make, Model, Colour, Year) |
|||
VALUES ('YFI002','Volkswagen','Golf','Dark Blue',2018); |
|||
INSERT INTO Vehicles (Registration, Make, Model, Colour, Year) |
|||
VALUES ('HGT5677','Skoda','Octavia','Graphite',2009); |
|||
INSERT INTO Vehicles (Registration, Make, Model, Colour, Year) |
|||
VALUES ('PPF9276','Skoda','Octavia','Graphite',2021); |
|||
INSERT INTO Vehicles (Registration, Make, Model, Colour, Year) |
|||
VALUES ('J893FT','Toyota','Corolla','Red',2015); |
|||
INSERT INTO Vehicles (Registration, Make, Model, Colour, Year) |
|||
VALUES ('MJK776','Honda','HR-V','Silver',2015); |
|||
|
|||
|
|||
INSERT INTO ServiceLog (Description, VehicleId, ServiceDate, Category, Mileage) |
|||
VALUES ('Change front brakes', 1, '2021-05-04', 'Brakes', 20667); |
|||
INSERT INTO ServiceLog (Description, VehicleId, ServiceDate, Category, Mileage) |
|||
VALUES ('Tyres - full set', 1, '2021-05-04', 'Brakes', 20667); |
|||
INSERT INTO ServiceLog (Description, VehicleId, ServiceDate, Category, Mileage) |
|||
VALUES ('Engine tune up', 2, '2021-07-14', 'Brakes', 50889); |
|||
INSERT INTO ServiceLog (Description, VehicleId, ServiceDate, Category, Mileage) |
|||
VALUES ('Replace transmission', 3, '2021-09-26', 'Transmission', 98002); |
|||
@ -0,0 +1,3 @@ |
|||
#!/bin/bash |
|||
docker-compose down |
|||
docker volume prune -f |
|||
Loading…
Reference in new issue