-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
371 additions
and
341 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
*.cast | ||
*.gif | ||
sample.sql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
-- Code generated by ddlctl. DO NOT EDIT. | ||
-- | ||
|
||
-- source: docs/sample.go:5 | ||
-- User is a user model struct. | ||
-- | ||
-- pgddl:table public.users | ||
-- pgddl:constraint UNIQUE ("username") | ||
CREATE TABLE public.users ( | ||
"user_id" TEXT NOT NULL, | ||
"username" TEXT NOT NULL, | ||
"age" INT NOT NULL, | ||
"description" TEXT NOT NULL, | ||
PRIMARY KEY ("user_id"), | ||
UNIQUE ("username") | ||
); | ||
|
||
-- source: docs/sample.go:7 | ||
-- pgddl:index "index_users_username" ON public.users ("username") | ||
CREATE INDEX "index_users_username" ON public.users ("username"); | ||
|
||
-- source: docs/sample.go:16 | ||
-- Group is a group model struct. | ||
-- | ||
-- pgddl:table CREATE TABLE IF NOT EXISTS public.groups | ||
CREATE TABLE IF NOT EXISTS public.groups ( | ||
"group_id" TEXT NOT NULL, | ||
"group_name" TEXT NOT NULL, | ||
"description" TEXT NOT NULL, | ||
PRIMARY KEY ("group_id") | ||
); | ||
|
||
-- source: docs/sample.go:17 | ||
-- pgddl:index CREATE UNIQUE INDEX "index_groups_group_name" ON public.groups ("group_name") | ||
CREATE UNIQUE INDEX "index_groups_group_name" ON public.groups ("group_name"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package sample | ||
|
||
// User is a user model struct. | ||
// | ||
//pgddl:table public.users | ||
//pgddl:constraint UNIQUE ("username") | ||
//pgddl:index "index_users_username" ON public.users ("username") | ||
type User struct { | ||
UserID string `db:"user_id" pgddl:"TEXT NOT NULL" pk:"true"` | ||
Username string `db:"username" pgddl:"TEXT NOT NULL"` | ||
Age int `db:"age" pgddl:"INT NOT NULL"` | ||
} | ||
|
||
// Group is a group model struct. | ||
// | ||
//pgddl:table CREATE TABLE IF NOT EXISTS public.groups | ||
//pgddl:index CREATE UNIQUE INDEX "index_groups_group_name" ON public.groups ("group_name") | ||
type Group struct { | ||
GroupID string `db:"group_id" pgddl:"TEXT NOT NULL" pk:"true"` | ||
GroupName string `db:"group_name" pgddl:"TEXT NOT NULL"` | ||
Description string `db:"description" pgddl:"TEXT NOT NULL"` | ||
} |