-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathschema.sql
More file actions
64 lines (61 loc) · 2.02 KB
/
schema.sql
File metadata and controls
64 lines (61 loc) · 2.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
--DROP TABLE IF EXISTS container_repositories;
--DROP TABLE IF EXISTS container_accounts;
--DROP TABLE IF EXISTS container_platforms;
DROP TABLE IF EXISTS github_repositories;
DROP TABLE IF EXISTS github_accounts;
--CREATE TABLE container_platforms (
-- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
-- name VARCHAR(255) NOT NULL UNIQUE,
-- pulls BIGINT DEFAULT 0,
-- stars INT DEFAULT 0,
-- created_at TIMESTAMPTZ DEFAULT NOW(),
-- updated_at TIMESTAMPTZ DEFAULT NOW(),
-- deleted_at TIMESTAMPTZ
--);
--
--CREATE TABLE container_accounts (
-- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
-- name VARCHAR(255) NOT NULL,
-- platform_id UUID NOT NULL REFERENCES container_platforms(id),
-- pulls BIGINT DEFAULT 0,
-- stars INT DEFAULT 0,
-- created_at TIMESTAMPTZ DEFAULT NOW(),
-- updated_at TIMESTAMPTZ DEFAULT NOW(),
-- deleted_at TIMESTAMPTZ,
-- UNIQUE(name, platform_id)
--);
--
--CREATE TABLE container_repositories (
-- id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
-- name VARCHAR(255) NOT NULL,
-- account_id UUID NOT NULL REFERENCES container_accounts(id),
-- pulls BIGINT DEFAULT 0,
-- stars INT DEFAULT 0,
-- created_at TIMESTAMPTZ DEFAULT NOW(),
-- updated_at TIMESTAMPTZ DEFAULT NOW(),
-- deleted_at TIMESTAMPTZ,
-- UNIQUE(name, account_id)
--);
CREATE TABLE github_accounts (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name VARCHAR(255) NOT NULL,
followers INT DEFAULT 0,
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW(),
deleted_at TIMESTAMPTZ,
UNIQUE(name)
);
CREATE TABLE github_repositories (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
name VARCHAR(255) NOT NULL,
account_id UUID NOT NULL REFERENCES github_accounts(id),
clones INT DEFAULT 0,
forks INT DEFAULT 0,
stars INT DEFAULT 0,
subscribers INT DEFAULT 0,
views BIGINT DEFAULT 0,
created_at TIMESTAMPTZ DEFAULT NOW(),
updated_at TIMESTAMPTZ DEFAULT NOW(),
deleted_at TIMESTAMPTZ,
UNIQUE(name, account_id)
);