Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9333d3a

Browse files
committed
chore: split queries.sql into files by table
1 parent6612e3c commit9333d3a

File tree

40 files changed

+3694
-3521
lines changed

40 files changed

+3694
-3521
lines changed

‎Makefile

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ coderd/database/dump.sql: $(wildcard coderd/database/migrations/*.sql)
1414
go run coderd/database/dump/main.go
1515

1616
# Generates Go code for querying the database.
17-
coderd/database/generate: fmt/sql coderd/database/dump.sql coderd/database/query.sql
17+
coderd/database/generate: fmt/sql coderd/database/dump.sql$(wildcardcoderd/database/queries/*.sql)
1818
cd coderd/database&& sqlc generate&& rm db_tmp.go
1919
cd coderd/database&& gofmt -w -r'Querier -> querier'*.go
2020
cd coderd/database&& gofmt -w -r'Queries -> sqlQuerier'*.go
@@ -30,13 +30,17 @@ else
3030
endif
3131
.PHONY: fmt/prettier
3232

33-
fmt/sql: ./coderd/database/query.sql
34-
npx sql-formatter\
35-
--language postgresql\
36-
--lines-between-queries 2\
37-
./coderd/database/query.sql\
38-
--output ./coderd/database/query.sql
39-
sed -i's/@ /@/g' ./coderd/database/query.sql
33+
fmt/sql:$(wildcard coderd/database/queries/*.sql)
34+
forfiin coderd/database/queries/*.sql;do \
35+
npx sql-formatter\
36+
--language postgresql\
37+
--lines-between-queries 2\
38+
--tab-indent\
39+
$$fi\
40+
--output$$fi;\
41+
done
42+
43+
sed -i 's/@ /@/g' ./coderd/database/queries/*.sql
4044

4145
fmt: fmt/prettier fmt/sql
4246
.PHONY: fmt

‎coderd/database/api_keys.sql.go

Lines changed: 173 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/dump.sql

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/files.sql.go

Lines changed: 67 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/migrations/000002_projects.up.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ CREATE TABLE projects (
3030

3131
-- Enforces no active projects have the same name.
3232
CREATEUNIQUE INDEXON projects (organization_id, name)WHERE deleted= FALSE;
33+
CREATEUNIQUE INDEXidx_projects_name_lowerON projects USING btree (lower(name));
3334

3435
-- Project Versions store historical project data. When a Project Version is imported,
3536
-- an "import" job is queued to parse parameters. A Project Version

‎coderd/database/migrations/000003_workspaces.up.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ CREATE TABLE workspaces (
99
);
1010

1111
-- Enforces no active workspaces have the same name.
12-
CREATEUNIQUE INDEXON workspaces (owner_id, name)WHERE deleted= FALSE;
12+
CREATEUNIQUE INDEXON workspaces USING btree (owner_id, name)WHERE deleted= FALSE;
13+
CREATEUNIQUE INDEXidx_workspaces_name_lowerON workspaces USING btree (lower(name));
1314

1415
CREATETYPEworkspace_transitionAS ENUM (
1516
'start',

‎coderd/database/organization_members.sql.go

Lines changed: 81 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp