Skip to content

Commit

Permalink
move app parts to obsolete
Browse files Browse the repository at this point in the history
  • Loading branch information
KrawMire committed May 18, 2024
1 parent f76b5af commit a900bc3
Show file tree
Hide file tree
Showing 276 changed files with 176 additions and 243 deletions.
15 changes: 8 additions & 7 deletions ScienceArchive.DB/scripts/updates/1_update_db_structure.sql
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
-- -----------------------------------------------------
-- Create DB schemas
-- -----------------------------------------------------
create schema "article";
create schema "category";
create schema "news";
create schema "notification";
create schema "user";
create schema "auth";
create schema if not exists "article";
create schema if not exists "category";
create schema if not exists "news";
create schema if not exists "notification";
create schema if not exists "user";
create schema if not exists "auth";

-- -----------------------------------------------------
-- Create new tables
Expand Down Expand Up @@ -260,4 +260,5 @@ VALUES
('24ed5057-487d-4887-8ee8-7342a04c7695', 'Description for VIEW_DECLINED_ARTICLES', 'VIEW_DECLINED_ARTICLES'),
('718c32b7-122b-4a62-a635-ef485f8d84cc', 'Description for APPROVE_ARTICLES', 'APPROVE_ARTICLES'),
('9aab0940-4cf0-4f53-a5b2-8f8fe46fc64f', 'Description for DECLINE_ARTICLES', 'DECLINE_ARTICLES'),
('f5934e5e-cc42-45b9-8151-094066968214', 'Description for ACCESS_ADMIN_PAGE', 'ACCESS_ADMIN_PAGE');
('f5934e5e-cc42-45b9-8151-094066968214', 'Description for ACCESS_ADMIN_PAGE', 'ACCESS_ADMIN_PAGE'),
('f47ac10b-58cc-4372-a567-0e02b2c3d479', 'Description for EDIT_NEWS', 'EDIT_NEWS');
23 changes: 10 additions & 13 deletions ScienceArchive.DB/tables/10_roles_claims.sql
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
-- Roles to claims junction table

CREATE TABLE IF NOT EXISTS "roles_claims" (
"role_id" UUID NOT NULL,
"claim_id" UUID NOT NULL,
create table if not exists "auth".roles_claims (
claim_id uuid not null,
role_id uuid not null,

PRIMARY KEY ("role_id", "claim_id"),
primary key (claim_id, role_id),

CONSTRAINT "idx__roles_claims__role_id__roles_id"
FOREIGN KEY ("role_id")
REFERENCES "roles" ("id"),

CONSTRAINT "idx__roles_claims__claim_id__claims_id"
FOREIGN KEY ("claim_id")
REFERENCES "claims" ("id")
constraint "fk__roles_claims__claim_id__claims__id"
foreign key (claim_id)
references "auth".claims(id),
constraint "fk__roles_claims__role_id__roles__id"
foreign key (role_id)
references "auth".roles(id)
);
File renamed without changes.
17 changes: 6 additions & 11 deletions ScienceArchive.DB/tables/1_claims.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
-- Claims

CREATE TABLE IF NOT EXISTS "claims" (
"id" UUID NOT NULL,
"value" VARCHAR(255) NOT NULL,
"name" VARCHAR(255) NULL,
"description" VARCHAR(255) NULL,

PRIMARY KEY ("id")
create table if not exists "auth".claims (
id uuid primary key,
value varchar(100) not null,
description varchar(255) null
);

CREATE INDEX IF NOT EXISTS "idx__claims__value"
ON "claims" ("value");
create index if not exists "idx__claims__value"
on "auth".claims (value);
16 changes: 6 additions & 10 deletions ScienceArchive.DB/tables/2_roles.sql
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
-- Roles

CREATE TABLE IF NOT EXISTS "roles" (
"id" UUID NOT NULL,
"name" VARCHAR(255) NOT NULL,
"description" VARCHAR(255) NULL,

PRIMARY KEY ("id")
create table if not exists "auth".roles (
id uuid primary key,
name varchar(255) not null,
description varchar(255) not null
);

CREATE INDEX IF NOT EXISTS "idx__roles__name"
ON "roles" ("name");
create index if not exists "idx__roles__name"
on "auth".roles(name);
21 changes: 11 additions & 10 deletions ScienceArchive.DB/tables/3_users.sql
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
-- Users main data

CREATE TABLE IF NOT EXISTS "users" (
"id" UUID NOT NULL,
"name" VARCHAR(100) NOT NULL,
"email" VARCHAR(50) NOT NULL,

PRIMARY KEY ("id")
create table if not exists "user".users (
id uuid primary key,
name varchar(255) not null,
email varchar(255) not null,
login varchar(255) not null,
about text null
);

CREATE INDEX IF NOT EXISTS "idx__users__email"
ON "users" ("email");
create index if not exists "idx__users__login"
on "user".users(login);

create index if not exists "idx__users__email"
on "user".users(email);
25 changes: 9 additions & 16 deletions ScienceArchive.DB/tables/4_users_auth.sql
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
-- Users auth data

CREATE TABLE IF NOT EXISTS "users_auth" (
"user_id" UUID NOT NULL,
"login" VARCHAR(30) NOT NULL,
"password" VARCHAR(255) NOT NULL,
"password_salt" VARCHAR(255) NOT NULL,
create table if not exists "auth".users_auth (
user_id uuid primary key,
is_confirmed boolean not null,
password varchar(255) not null,
password_salt varchar(255) not null,

PRIMARY KEY ("user_id"),

CONSTRAINT "FK__users_auth__user_id__users__id"
FOREIGN KEY ("user_id")
REFERENCES "users" ("id")
);

CREATE INDEX IF NOT EXISTS idx__users_auth__login
ON "users_auth" ("login");
constraint "fk__users_auth__user_id__users__id"
foreign key (user_id)
references "user".users(id)
);
23 changes: 13 additions & 10 deletions ScienceArchive.DB/tables/5_news.sql
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
-- News

CREATE TABLE IF NOT EXISTS "news" (
"id" UUID NOT NULL,
"title" VARCHAR(255) NOT NULL,
"body" TEXT NOT NULL,

PRIMARY KEY ("id")
create table if not exists "news".news (
id uuid primary key,
author_id uuid not null,
title varchar(255) not null,
body text not null,
creation_date timestamp not null,
last_updated_date timestamp null,

constraint "fk__news__author_id__users__id"
foreign key (author_id)
references "user".users (id)
);

CREATE INDEX IF NOT EXISTS idx__news__title
ON "news" ("title");
create index if not exists "idx__news__title"
on "news".news(title);
File renamed without changes.
File renamed without changes.
20 changes: 9 additions & 11 deletions ScienceArchive.DB/tables/9_articles_documents.sql
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
-- Documents linked to articles

CREATE TABLE IF NOT EXISTS "articles_documents" (
"article_id" UUID NOT NULL,
"document_path" VARCHAR(255) NOT NULL,
create table if not exists "article".articles_documents (
id uuid primary key,
article_id uuid not null,
name varchar(255) not null,
filepath varchar(255) not null,

PRIMARY KEY ("article_id", "document_path"),

CONSTRAINT "FK__articles_documents__article_id__articles__id"
FOREIGN KEY ("article_id")
REFERENCES "articles" ("id")
);
constraint "fk__articles_documents__article_id__articles__id"
foreign key (article_id)
references "article".articles(id)
);
13 changes: 0 additions & 13 deletions ScienceArchive.DB/tables/update1/10_roles_claims.sql

This file was deleted.

8 changes: 0 additions & 8 deletions ScienceArchive.DB/tables/update1/1_claims.sql

This file was deleted.

8 changes: 0 additions & 8 deletions ScienceArchive.DB/tables/update1/2_roles.sql

This file was deleted.

13 changes: 0 additions & 13 deletions ScienceArchive.DB/tables/update1/3_users.sql

This file was deleted.

10 changes: 0 additions & 10 deletions ScienceArchive.DB/tables/update1/4_users_auth.sql

This file was deleted.

15 changes: 0 additions & 15 deletions ScienceArchive.DB/tables/update1/5_news.sql

This file was deleted.

10 changes: 0 additions & 10 deletions ScienceArchive.DB/tables/update1/9_articles_documents.sql

This file was deleted.

16 changes: 16 additions & 0 deletions obsolete/db/tables /10_roles_claims.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- Roles to claims junction table

CREATE TABLE IF NOT EXISTS "roles_claims" (
"role_id" UUID NOT NULL,
"claim_id" UUID NOT NULL,

PRIMARY KEY ("role_id", "claim_id"),

CONSTRAINT "idx__roles_claims__role_id__roles_id"
FOREIGN KEY ("role_id")
REFERENCES "roles" ("id"),

CONSTRAINT "idx__roles_claims__claim_id__claims_id"
FOREIGN KEY ("claim_id")
REFERENCES "claims" ("id")
);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 13 additions & 0 deletions obsolete/db/tables /1_claims.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
-- Claims

CREATE TABLE IF NOT EXISTS "claims" (
"id" UUID NOT NULL,
"value" VARCHAR(255) NOT NULL,
"name" VARCHAR(255) NULL,
"description" VARCHAR(255) NULL,

PRIMARY KEY ("id")
);

CREATE INDEX IF NOT EXISTS "idx__claims__value"
ON "claims" ("value");
12 changes: 12 additions & 0 deletions obsolete/db/tables /2_roles.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Roles

CREATE TABLE IF NOT EXISTS "roles" (
"id" UUID NOT NULL,
"name" VARCHAR(255) NOT NULL,
"description" VARCHAR(255) NULL,

PRIMARY KEY ("id")
);

CREATE INDEX IF NOT EXISTS "idx__roles__name"
ON "roles" ("name");
12 changes: 12 additions & 0 deletions obsolete/db/tables /3_users.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Users main data

CREATE TABLE IF NOT EXISTS "users" (
"id" UUID NOT NULL,
"name" VARCHAR(100) NOT NULL,
"email" VARCHAR(50) NOT NULL,

PRIMARY KEY ("id")
);

CREATE INDEX IF NOT EXISTS "idx__users__email"
ON "users" ("email");
17 changes: 17 additions & 0 deletions obsolete/db/tables /4_users_auth.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- Users auth data

CREATE TABLE IF NOT EXISTS "users_auth" (
"user_id" UUID NOT NULL,
"login" VARCHAR(30) NOT NULL,
"password" VARCHAR(255) NOT NULL,
"password_salt" VARCHAR(255) NOT NULL,

PRIMARY KEY ("user_id"),

CONSTRAINT "FK__users_auth__user_id__users__id"
FOREIGN KEY ("user_id")
REFERENCES "users" ("id")
);

CREATE INDEX IF NOT EXISTS idx__users_auth__login
ON "users_auth" ("login");
12 changes: 12 additions & 0 deletions obsolete/db/tables /5_news.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- News

CREATE TABLE IF NOT EXISTS "news" (
"id" UUID NOT NULL,
"title" VARCHAR(255) NOT NULL,
"body" TEXT NOT NULL,

PRIMARY KEY ("id")
);

CREATE INDEX IF NOT EXISTS idx__news__title
ON "news" ("title");
File renamed without changes.
File renamed without changes.
File renamed without changes.
12 changes: 12 additions & 0 deletions obsolete/db/tables /9_articles_documents.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Documents linked to articles

CREATE TABLE IF NOT EXISTS "articles_documents" (
"article_id" UUID NOT NULL,
"document_path" VARCHAR(255) NOT NULL,

PRIMARY KEY ("article_id", "document_path"),

CONSTRAINT "FK__articles_documents__article_id__articles__id"
FOREIGN KEY ("article_id")
REFERENCES "articles" ("id")
);
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit a900bc3

Please sign in to comment.