add db migrations
This commit is contained in:
parent
eb90e45ee5
commit
93731a987e
6 changed files with 19 additions and 0 deletions
1
migrations/20240423031756_create-projects-table.down.sql
Normal file
1
migrations/20240423031756_create-projects-table.down.sql
Normal file
|
|
@ -0,0 +1 @@
|
|||
DROP TABLE projects;
|
||||
6
migrations/20240423031756_create-projects-table.up.sql
Normal file
6
migrations/20240423031756_create-projects-table.up.sql
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
CREATE TABLE projects (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
repository_url VARCHAR(255),
|
||||
description VARCHAR(255) NOT NULL
|
||||
);
|
||||
1
migrations/20240423032721_create-techs-table.down.sql
Normal file
1
migrations/20240423032721_create-techs-table.down.sql
Normal file
|
|
@ -0,0 +1 @@
|
|||
DROP TABLE technologies;
|
||||
5
migrations/20240423032721_create-techs-table.up.sql
Normal file
5
migrations/20240423032721_create-techs-table.up.sql
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
CREATE TABLE technologies (
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR(25) NOT NULL UNIQUE,
|
||||
url TEXT NOT NULL
|
||||
);
|
||||
|
|
@ -0,0 +1 @@
|
|||
DROP TABLE projects_technologies;
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
CREATE TABLE projects_technologies (
|
||||
project_id INTEGER NOT NULL REFERENCES projects(id),
|
||||
technology_id INTEGER NOT NULL REFERENCES technologies(id),
|
||||
PRIMARY KEY (project_id, technology_id) -- ensures a project-technology pair is unique
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue