Skip to content

Commit

Permalink
Merge pull request #179 from wubin1989/main
Browse files Browse the repository at this point in the history
v2.2.3
  • Loading branch information
wubin1989 authored Dec 29, 2023
2 parents 53c447b + c013717 commit 197db22
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
13 changes: 8 additions & 5 deletions toolkit/dbvendor/ivendor.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,16 @@ type Column struct {

// Table defines a table
type Table struct {
Name string
Columns []Column
BizColumns []Column
Pk string
Joins []string
TablePrefix string
Name string
Columns []Column
BizColumns []Column
Pk string
Joins []string
// 父表
Inherited string
// 该表是否仅用于同步/复制数据
IsCopy bool
}

func String(tmplname, tmpl string, data interface{}, pf PlaceholderFormat) (string, error) {
Expand Down
6 changes: 3 additions & 3 deletions toolkit/dbvendor/postgres/template.go
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package postgres

var (
createTable = `CREATE TABLE "{{.Name}}" (
createTable = `CREATE TABLE IF NOT EXISTS {{if .TablePrefix }}"{{.TablePrefix}}".{{end}}"{{.Name}}" (
{{- range $co := .Columns }}
"{{$co.Name}}" {{$co.Type}} {{if $co.Nullable}}NULL{{else}}NOT NULL{{end}}{{if $co.Default}} DEFAULT {{$co.Default}}{{end}},
"{{$co.Name}}" {{$co.Type}} {{if $co.Nullable}}NULL{{else}}NOT NULL{{end}}{{if $co.Default}} DEFAULT '{{$co.Default}}'{{end}},
{{- end }}
PRIMARY KEY ("{{.Pk}}"))
{{- if .Inherited }}
INHERITS ({{.Inherited}})
{{- end }};
{{- if not .Inherited }}
{{- if and (not .Inherited) (not .IsCopy) }}
CREATE OR REPLACE FUNCTION update_updated_at_column()
RETURNS TRIGGER AS $$
BEGIN
Expand Down
2 changes: 1 addition & 1 deletion version/version.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package version

const Release = "v2.2.2"
const Release = "v2.2.3"

0 comments on commit 197db22

Please sign in to comment.