Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add content types table #1397

Merged
merged 30 commits into from
Jan 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
4c2f35b
feat: add content types table
abyssparanoia Jan 4, 2025
73f99df
feat: add content types table
abyssparanoia Jan 4, 2025
ea182da
feat: add content types table
abyssparanoia Jan 4, 2025
1ca495f
feat: add content types table
abyssparanoia Jan 4, 2025
e387e18
feat: add content types table
abyssparanoia Jan 4, 2025
620bca3
feat: add content types table
abyssparanoia Jan 4, 2025
789993d
feat: add content types table
abyssparanoia Jan 4, 2025
167b63b
feat: add content types table
abyssparanoia Jan 4, 2025
dae1114
feat: add content types table
abyssparanoia Jan 4, 2025
f1f475c
feat: add content types table
abyssparanoia Jan 4, 2025
b8a73a5
feat: add content types table
abyssparanoia Jan 4, 2025
1205649
feat: add content types table
abyssparanoia Jan 4, 2025
0abc665
feat: add content types table
abyssparanoia Jan 4, 2025
bf43f9d
feat: add content types table
abyssparanoia Jan 4, 2025
b1387a2
feat: add content types table
abyssparanoia Jan 4, 2025
c024898
feat: add content types table
abyssparanoia Jan 4, 2025
e8889e8
feat: add content types table
abyssparanoia Jan 4, 2025
e07953b
feat: add content types table
abyssparanoia Jan 4, 2025
82a3dd2
feat: add content types table
abyssparanoia Jan 4, 2025
3154135
feat: add content types table
abyssparanoia Jan 4, 2025
a1958b6
feat: add content types table
abyssparanoia Jan 4, 2025
87b6210
feat: add content types table
abyssparanoia Jan 4, 2025
438394a
feat: add content types table
abyssparanoia Jan 4, 2025
7633a2c
feat: add content types table
abyssparanoia Jan 4, 2025
8f8a382
feat: add content types table
abyssparanoia Jan 4, 2025
0503b4e
feat: add content types table
abyssparanoia Jan 4, 2025
73f7929
feat: add content types table
abyssparanoia Jan 4, 2025
f0adb77
feat: add content types table
abyssparanoia Jan 4, 2025
2bd68c6
feat: add content types table
abyssparanoia Jan 4, 2025
c7a2965
feat: add content types table
abyssparanoia Jan 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions db/main/constants/content_types.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ids:
- image/png
- image/jpeg
- application/zip
- application/pdf
- text/csv
12 changes: 10 additions & 2 deletions db/main/migrations/1_initialize.sql
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
-- +goose Up
CREATE TABLE `content_types` (
`id` VARCHAR(256) NOT NULL COMMENT "id",
CONSTRAINT `content_types_pkey` PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
COMMENT "content_type";

CREATE TABLE `asset_types` (
`id` VARCHAR(256) NOT NULL COMMENT "id",
CONSTRAINT `asset_types_pkey` PRIMARY KEY (`id`)
Expand All @@ -7,14 +13,15 @@ COMMENT "asset_type";

CREATE TABLE `assets` (
`id` VARCHAR(64) NOT NULL COMMENT "id",
`content_type` VARCHAR(1024) NOT NULL COMMENT "content_type",
`content_type` VARCHAR(256) NOT NULL COMMENT "content_type",
`type` VARCHAR(256) NOT NULL COMMENT "type",
`path` TEXT NOT NULL COMMENT "path",
`expires_at` DATETIME NOT NULL COMMENT "expires_at",
`created_at` DATETIME NOT NULL COMMENT "created date",
`updated_at` DATETIME NOT NULL COMMENT "update date",
CONSTRAINT `assets_pkey` PRIMARY KEY (`id`),
CONSTRAINT `assets_fkey_type` FOREIGN KEY (`type`) REFERENCES `asset_types` (`id`)
CONSTRAINT `assets_fkey_type` FOREIGN KEY (`type`) REFERENCES `asset_types` (`id`),
CONSTRAINT `assets_fkey_content_type` FOREIGN KEY (`content_type`) REFERENCES `content_types` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4
COMMENT "asset";

Expand Down Expand Up @@ -57,3 +64,4 @@ DROP TABLE staff_roles;
DROP TABLE tenants;
DROP TABLE assets;
DROP TABLE asset_types;
DROP TABLE content_types;
9 changes: 8 additions & 1 deletion db/main/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,24 @@ CREATE TABLE `asset_types` (

CREATE TABLE `assets` (
`id` varchar(64) NOT NULL COMMENT 'id',
`content_type` varchar(1024) NOT NULL COMMENT 'content_type',
`content_type` varchar(256) NOT NULL COMMENT 'content_type',
`type` varchar(256) NOT NULL COMMENT 'type',
`path` text NOT NULL COMMENT 'path',
`expires_at` datetime NOT NULL COMMENT 'expires_at',
`created_at` datetime NOT NULL COMMENT 'created date',
`updated_at` datetime NOT NULL COMMENT 'update date',
PRIMARY KEY (`id`),
KEY `assets_fkey_type` (`type`),
KEY `assets_fkey_content_type` (`content_type`),
CONSTRAINT `assets_fkey_content_type` FOREIGN KEY (`content_type`) REFERENCES `content_types` (`id`),
CONSTRAINT `assets_fkey_type` FOREIGN KEY (`type`) REFERENCES `asset_types` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='asset';

CREATE TABLE `content_types` (
`id` varchar(256) NOT NULL COMMENT 'id',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='content_type';

CREATE TABLE `goose_db_version` (
`id` bigint unsigned NOT NULL AUTO_INCREMENT,
`version_id` bigint NOT NULL,
Expand Down
12 changes: 8 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ require (
google.golang.org/genproto/googleapis/rpc v0.0.0-20241230172942-26aa7a208def
google.golang.org/grpc v1.69.2
google.golang.org/protobuf v1.36.1
gopkg.in/yaml.v2 v2.4.0
mvdan.cc/gofumpt v0.7.0
)

Expand Down Expand Up @@ -98,11 +99,11 @@ require (
github.com/Microsoft/go-winio v0.6.2 // indirect
github.com/Microsoft/hcsshim v0.12.9 // indirect
github.com/OpenPeeDeeP/depguard/v2 v2.2.0 // indirect
github.com/alecthomas/assert/v2 v2.11.0 // indirect
github.com/alecthomas/go-check-sumtype v0.3.1 // indirect
github.com/alexkohler/nakedret/v2 v2.0.5 // indirect
github.com/alexkohler/prealloc v1.0.0 // indirect
github.com/alingse/asasalint v0.0.11 // indirect
github.com/alingse/nilnesserr v0.1.1 // indirect
github.com/antlr4-go/antlr/v4 v4.13.1 // indirect
github.com/ashanbrown/forbidigo v1.6.0 // indirect
github.com/ashanbrown/makezero v1.2.0 // indirect
Expand Down Expand Up @@ -211,7 +212,6 @@ require (
github.com/golangci/go-printf-func-name v0.1.0 // indirect
github.com/golangci/gofmt v0.0.0-20241223200906-057b0627d9b9 // indirect
github.com/golangci/misspell v0.6.0 // indirect
github.com/golangci/modinfo v0.3.4 // indirect
github.com/golangci/plugin-module-register v0.1.1 // indirect
github.com/golangci/revgrep v0.5.3 // indirect
github.com/golangci/unconvert v0.0.0-20240309020433-c5143eacb3ed // indirect
Expand All @@ -227,8 +227,10 @@ require (
github.com/gostaticanalysis/forcetypeassert v0.1.0 // indirect
github.com/gostaticanalysis/nilerr v0.1.1 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-immutable-radix/v2 v2.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-version v1.7.0 // indirect
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hexops/gotextdiff v1.0.3 // indirect
github.com/huandu/xstrings v1.3.2 // indirect
Expand All @@ -252,8 +254,11 @@ require (
github.com/kunwardeep/paralleltest v1.0.10 // indirect
github.com/kyoh86/exportloopref v0.1.11 // indirect
github.com/lasiar/canonicalheader v1.1.2 // indirect
github.com/ldez/exptostd v0.3.1 // indirect
github.com/ldez/gomoddirectives v0.6.0 // indirect
github.com/ldez/grignotin v0.7.0 // indirect
github.com/ldez/tagliatelle v0.7.1 // indirect
github.com/ldez/usetesting v0.4.2 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/leonklingele/grouper v1.1.2 // indirect
github.com/lestrrat-go/blackmagic v1.0.2 // indirect
Expand Down Expand Up @@ -323,7 +328,7 @@ require (
github.com/ryancurrah/gomodguard v1.3.5 // indirect
github.com/ryanrolds/sqlclosecheck v0.5.1 // indirect
github.com/sanposhiho/wastedassign/v2 v2.1.0 // indirect
github.com/santhosh-tekuri/jsonschema/v5 v5.3.1 // indirect
github.com/santhosh-tekuri/jsonschema/v6 v6.0.1 // indirect
github.com/sashamelentyev/interfacebloat v1.1.0 // indirect
github.com/sashamelentyev/usestdlibvars v1.28.0 // indirect
github.com/securego/gosec/v2 v2.21.4 // indirect
Expand Down Expand Up @@ -403,7 +408,6 @@ require (
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
honnef.co/go/tools v0.5.1 // indirect
mvdan.cc/unparam v0.0.0-20240528143540-8a5130ca722f // indirect
Expand Down
Loading
Loading