Added vcs types to the schema so i can get the root url for the given vcs
ci/woodpecker/push/woodpecker Pipeline was successful Details

This commit is contained in:
Martin Slot 2022-11-10 13:59:22 +01:00
parent ed65e9a392
commit 140e6d1b04
1 changed files with 19 additions and 6 deletions

View File

@ -1,13 +1,15 @@
/*
TODO: should the vcs_type only be on the Origins? And then have a primary key (forward key) on origins that currents can reference?
TODO: change table naming to lowercase so it confirms to Postgres, the one and only true database
*/
CREATE TABLE IF NOT EXISTS Origins
(
name NVARCHAR(50),
vcs_type NVARCHAR(20),
owner_name NVARCHAR(100),
repo_name NVARCHAR(100),
PRIMARY KEY (name, vcs_type)
name NVARCHAR(50),
vcs_type NVARCHAR(20),
owner_name NVARCHAR(100),
repo_name NVARCHAR(100),
PRIMARY KEY (name, vcs_type),
FOREIGN KEY (vcs_type) REFERENCES VcsTypes (vcs_type)
);
CREATE TABLE IF NOT EXISTS Currents
@ -16,5 +18,16 @@ CREATE TABLE IF NOT EXISTS Currents
version NVARCHAR(50),
vcs_type NVARCHAR(20),
PRIMARY KEY (name, vcs_type),
FOREIGN KEY (name, vcs_type) REFERENCES Origins (name, vcs_type)
FOREIGN KEY (name, vcs_type) REFERENCES Origins (name, vcs_type),
FOREIGN KEY (vcs_type) REFERENCES VcsTypes (vcs_type)
);
CREATE TABLE IF NOT EXISTS VcsTypes
(
vcs_type NVARCHAR(50),
api_root_url NVARCHAR(100),
PRIMARY KEY (vcs_type)
);
INSERT INTO VcsTypes (vcs_type, api_root_url)
VALUES ('github', 'https://api.github.com')