diff --git a/CHANGELOG.md b/CHANGELOG.md index 2eb6ccb8..53bf845c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -99,6 +99,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 It is possible to do the same thing, with similar effor using the the `UpdateQ` and `DeleteQ` methods (which are now renamed to `Update` and `Delete`). - `context.Context` and `bob.Executor` are no longer passed when creating a Table/ViewQuery. It is now passed at the point of execution with `Exec/One/All/Cursor`. - Remove `Prepare` methods from table and view qureries. Since `bob.Prepare()` now takes a type parameter, it is not possible to prepare from a method since Go does not allow additional type parameters in methods. +- Removed the **Prisma** and **Atlas** code generation drivers. It is better for Bob to focus on being able to generate code from the database in the most robust and detailed way and if the user wants, they can use other tools (such as prisma and atlas) to manage migrations before the code generation. ### Fixed diff --git a/README.md b/README.md index 15425dce..06e97e8a 100644 --- a/README.md +++ b/README.md @@ -37,8 +37,6 @@ Check out [the documentation][docs] for more information. | Postgres | ✅ | ✅ | ✅ | ✅ | | MySQL/MariaDB | ✅ | ✅ | ✅ | ✅ | | SQLite | ✅ | ✅ | ✅ | ✅ | -| Atlas | | | ✅ | ✅ | -| Prisma | | | ✅ | ✅ | ## Comparisons diff --git a/gen/bobgen-atlas/driver/atlas.go b/gen/bobgen-atlas/driver/atlas.go deleted file mode 100644 index feea0c14..00000000 --- a/gen/bobgen-atlas/driver/atlas.go +++ /dev/null @@ -1,615 +0,0 @@ -package driver - -import ( - "bytes" - "context" - "fmt" - "io/fs" - "sort" - "strings" - - "ariga.io/atlas/schemahcl" - "ariga.io/atlas/sql/mysql" - "ariga.io/atlas/sql/postgres" - "ariga.io/atlas/sql/schema" - "ariga.io/atlas/sql/sqlite" - helpers "github.com/stephenafamo/bob/gen/bobgen-helpers" - "github.com/stephenafamo/bob/gen/drivers" - "github.com/stephenafamo/bob/gen/importers" - "github.com/volatiletech/strmangle" -) - -type ( - Interface = drivers.Interface[any] - DBInfo = drivers.DBInfo[any] - Config struct { - // What dialect to generate with - // psql | mysql | sqlite - Dialect string - // Where the hcl files are - Dir string - // The name of this schema will not be included in the generated models - // a context value can then be used to set the schema at runtime - // useful for multi-tenant setups - SharedSchema string `yaml:"shared_schema"` - // List of tables that will be included. Others are ignored - Only map[string][]string - // List of tables that will be should be ignored. Others are included - Except map[string][]string - // Which UUID package to use (gofrs or google) - UUIDPkg string `yaml:"uuid_pkg"` - - Output string - Pkgname string - NoFactory bool `yaml:"no_factory"` - } -) - -func New(config Config, fs fs.FS) Interface { - types := helpers.Types() - - switch config.UUIDPkg { - case "google": - types["uuid.UUID"] = drivers.Type{ - Imports: importers.List{`"github.com/google/uuid"`}, - RandomExpr: `return uuid.New()`, - } - default: - types["uuid.UUID"] = drivers.Type{ - Imports: importers.List{`"github.com/gofrs/uuid/v5"`}, - RandomExpr: `return uuid.Must(uuid.NewV4())`, - } - } - - return &driver{ - config: config, - fs: fs, - types: types, - } -} - -// driver holds the database connection string and a handle -// to the database connection. -type driver struct { - config Config - fs fs.FS - enums map[string]drivers.Enum - types drivers.Types -} - -func (d *driver) Dialect() string { - return d.config.Dialect -} - -func (d *driver) Capabilities() drivers.Capabilities { - return drivers.Capabilities{} -} - -func (d *driver) Types() drivers.Types { - return d.types -} - -// Assemble all the information we need to provide back to the driver -func (d *driver) Assemble(ctx context.Context) (*DBInfo, error) { - var err error - var dbinfo *DBInfo - var evalFunc schemahcl.EvalFunc - switch d.config.Dialect { - case "psql": - evalFunc = postgres.EvalHCL - case "mysql": - evalFunc = mysql.EvalHCL - case "sqlite": - evalFunc = sqlite.EvalHCL - case "": - return nil, fmt.Errorf("dialect must be specified") - default: - return nil, fmt.Errorf("Unsupported dialect %q", d.config.Dialect) - } - - parser, err := parseHCLPaths(d.fs) - if err != nil { - return nil, err - } - - realm := &schema.Realm{} - if err := evalFunc(parser, realm, nil); err != nil { - return nil, err - } - - if d.config.SharedSchema == "" { - d.config.SharedSchema = realm.Schemas[0].Name - } - - d.loadEnums(realm) - dbinfo = &DBInfo{ - Enums: d.getEnums(), - Tables: d.tables(realm), - } - - return dbinfo, err -} - -func (d *driver) key(schema string, table string) string { - key := table - if schema != "" && schema != d.config.SharedSchema { - key = schema + "." + table - } - - return key -} - -func (d *driver) schema(schema string) string { - if schema == d.config.SharedSchema { - return "" - } - - return schema -} - -func (d *driver) tables(realm *schema.Realm) []drivers.Table { - tables := make([]drivers.Table, 0, len(realm.Schemas)) - - tblFilter := drivers.ParseTableFilter(d.config.Only, d.config.Except) - - colFilter := drivers.ParseColumnFilter(d.tableNames(realm, drivers.Filter{ - Only: tblFilter.Only, - Except: tblFilter.Except, - }), d.config.Only, d.config.Except) - - for _, schema := range realm.Schemas { - for _, atlasTable := range schema.Tables { - if drivers.Skip(atlasTable.Name, tblFilter.Only, tblFilter.Except) { - continue - } - - pk, uniques, fks := d.getKeys(atlasTable, colFilter) - table := drivers.Table{ - Key: d.key(schema.Name, atlasTable.Name), - Schema: d.schema(schema.Name), - Name: atlasTable.Name, - Constraints: drivers.Constraints{ - Primary: pk, - Uniques: uniques, - Foreign: fks, - }, - Columns: d.tableColumns(atlasTable, colFilter), - Indexes: d.indexes(atlasTable, colFilter), - } - tables = append(tables, table) - } - } - - return tables -} - -func (d *driver) tableNames(realm *schema.Realm, tableFilter drivers.Filter) []string { - names := make([]string, 0, len(realm.Schemas)) - - for _, s := range realm.Schemas { - for _, m := range s.Tables { - key := d.key(s.Name, m.Name) - if drivers.Skip(key, tableFilter.Only, tableFilter.Except) { - continue - } - - names = append(names, key) - } - } - - return names -} - -func (d *driver) tableColumns(table *schema.Table, colFilter drivers.ColumnFilter) []drivers.Column { - key := d.key(table.Schema.Name, table.Name) - allfilter := colFilter["*"] - filter := colFilter[key] - include := append(allfilter.Only, filter.Only...) - exclude := append(allfilter.Except, filter.Except...) - - columns := make([]drivers.Column, 0, len(table.Columns)) - for _, atlasCol := range table.Columns { - if drivers.Skip(atlasCol.Name, include, exclude) { - continue - } - - var dbType bytes.Buffer - // err := json.NewEncoder(&dbType).Encode(atlasCol.Type) - // if err != nil { - // return nil, err - // } - - column := drivers.Column{ - Name: atlasCol.Name, - DBType: strings.TrimSpace(dbType.String()), - Nullable: atlasCol.Type.Null, - } - - for _, a := range atlasCol.Attrs { - // Get the column comment - if attr, ok := a.(*schema.Comment); ok && attr != nil { - column.Comment = attr.Text - } - - // If the column has a generation expression - if attr, ok := a.(*schema.GeneratedExpr); ok && attr != nil { - column.Generated = true - } - // Postgres identity columns are generated - if attr, ok := a.(*postgres.Identity); ok && attr != nil { - column.Generated = true - } - - // check for mysql autoincr columns - if attr, ok := a.(*mysql.AutoIncrement); ok && attr != nil { - column.AutoIncr = true - } - // check for sqlite autoincr columns - if attr, ok := a.(*sqlite.AutoIncrement); ok && attr != nil { - column.AutoIncr = true - } - } - - if atlasCol.Default != nil { - column.Default = "DEFAULT" - } - - // A generated column technically has a default value - if column.Generated && column.Default == "" { - column.Default = "GENERATED" - } - - // A nullable column can always default to NULL - if atlasCol.Type.Null && column.Default == "" { - column.Default = "NULL" - } - - column = d.translateColumnType(column, key, atlasCol.Type.Type) - columns = append(columns, column) - } - - return columns -} - -//nolint:gocyclo -func (d *driver) translateColumnType(c drivers.Column, tableKey string, typ schema.Type) drivers.Column { - switch t := typ.(type) { - case *schema.BoolType: - c.Type = "bool" - - case *schema.StringType: - c.Type = "string" - - case *schema.BinaryType: - c.Type = "[]byte" - - case *schema.IntegerType: - switch t.T { - case "tinyint": - c.Type = "int8" - case "smallint": - c.Type = "int16" - case "mediumint": - c.Type = "int32" - case "int", "integer": - c.Type = "int32" - case "bigint": - c.Type = "int64" - default: - c.Type = "int" - } - if t.Unsigned { - c.Type = "u" + c.Type - } - - case *postgres.SerialType: - switch t.T { - case "smallserial", "serial2": - c.Type = "int16" - case "serial", "serial4": - c.Type = "int32" - case "bigserial", "serial8": - c.Type = "int64" - default: - c.Type = "int" - } - - case *schema.FloatType: - switch t.T { - case "float": - c.Type = "float32" - if t.Precision > 24 { - c.Type = "float64" - } - case "real": - c.Type = "float32" - case "double", "double precision": - c.Type = "float64" - default: - c.Type = "float64" - } - - case *schema.TimeType: - c.Type = "time.Time" - - case *schema.DecimalType: - c.Type = "decimal.Decimal" - - case *schema.JSONType: - c.Type = "types.JSON[json.RawMessage]" - - case *schema.UUIDType: - c.Type = "uuid.UUID" - - case *schema.EnumType: - enumName := t.T - if d.config.Dialect == "mysql" { - enumName = tableKey + "_" + c.Name - } - - if enum, ok := d.enums[enumName]; ok { - c.Type = helpers.EnumType(d.types, enum.Type) - } else { - c.Type = "string" - } - - case *schema.SpatialType: - if d.config.Dialect != "psql" { - c.Type = "string" - break - } - - switch t.T { - case "box": - c.Type = "pgeo.Box" - case "circle": - c.Type = "pgeo.Circle" - case "line": - c.Type = "pgeo.Line" - case "lseg": - c.Type = "pgeo.Lseg" - case "path": - c.Type = "pgeo.Path" - case "point": - c.Type = "pgeo.Point" - case "polygon": - c.Type = "pgeo.Polygon" - default: - c.Type = "string" - } - - case *postgres.ArrayType: - switch t.Type.(type) { - case *schema.BoolType: - c.Type = "pq.BoolArray" - case *schema.BinaryType: - c.Type = "pq.ByteaArray" - case *schema.StringType: - c.Type = "pq.StringArray" - case *schema.FloatType: - c.Type = "pq.Float64Array" - case *schema.IntegerType, *postgres.SerialType: - c.Type = "pq.Int64Array" - case *schema.EnumType: - c2 := d.translateColumnType(c, tableKey, t.Type) - c.Type = helpers.AddPgEnumArrayType(d.types, c2.Type) - default: - c2 := d.translateColumnType(c, tableKey, t.Type) - c.Type = helpers.AddPgGenericArrayType(d.types, c2.Type) - } - - default: - c.Type = "string" - } - - return c -} - -func (d *driver) getKeys(table *schema.Table, colFilter drivers.ColumnFilter) (*drivers.PrimaryKey, []drivers.Constraint, []drivers.ForeignKey) { - var pk *drivers.PrimaryKey - var uniques []drivers.Constraint - var fks []drivers.ForeignKey - - filter := colFilter[d.key(table.Schema.Name, table.Name)] - only := filter.Only - except := filter.Except - - // If it is a composite primary key defined on the model - if table.PrimaryKey != nil && len(table.PrimaryKey.Parts) > 0 { - shouldSkip := false - cols := make([]string, len(table.PrimaryKey.Parts)) - - for i, p := range table.PrimaryKey.Parts { - if p.C == nil || drivers.Skip(p.C.Name, only, except) { - shouldSkip = true - } - cols[i] = p.C.Name - } - - if !shouldSkip { - pkName := table.PrimaryKey.Name - if pkName == "" { - pkName = "pk_" + table.Name - } - pk = &drivers.Constraint{ - Name: pkName, - Columns: cols, - } - } - } - - for _, unique := range table.Indexes { - if !unique.Unique { - continue - } - - shouldSkip := false - cols := make([]string, len(unique.Parts)) - - for i, f := range unique.Parts { - if f.X != nil || drivers.Skip(f.C.Name, only, except) { - shouldSkip = true - } - - cols[i] = f.C.Name - } - - if !shouldSkip { - keyName := unique.Name - if keyName == "" { - keyName = fmt.Sprintf("unique_%s_%s", table.Name, strings.Join(cols, "_")) - } - - uniques = append(uniques, drivers.Constraint{ - Name: keyName, - Columns: cols, - }) - } - } - - for i, fk := range table.ForeignKeys { - shouldSkip := false - - ftableKey := d.key(fk.RefTable.Schema.Name, fk.RefTable.Name) - fFilter := colFilter[ftableKey] - - cols := make([]string, len(fk.Columns)) - fcols := make([]string, len(fk.RefColumns)) - - for i := range fk.Columns { - cols[i] = fk.Columns[i].Name - fcols[i] = fk.RefColumns[i].Name - - if drivers.Skip(cols[i], only, except) || - drivers.Skip(fcols[i], fFilter.Only, fFilter.Except) { - shouldSkip = true - } - } - - if !shouldSkip { - keyName := fmt.Sprintf("fk_%s_%d", table.Name, i) - - fks = append(fks, drivers.ForeignKey{ - Name: keyName, - Columns: cols, - ForeignTable: ftableKey, - ForeignColumns: fcols, - }) - } - } - - return pk, uniques, fks -} - -func (d *driver) loadEnums(realm *schema.Realm) { - if d.enums != nil { - return - } - d.enums = map[string]drivers.Enum{} - - for _, s := range realm.Schemas { - for _, t := range s.Tables { - tableKey := d.key(t.Schema.Name, t.Name) - for _, c := range t.Columns { - enum, ok := c.Type.Type.(*schema.EnumType) - if !ok { - continue - } - enumName := enum.T - if d.config.Dialect == "mysql" { - enumName = tableKey + "_" + c.Name - } - - d.enums[enumName] = drivers.Enum{ - Type: strmangle.TitleCase(enumName), - Values: enum.Values, - } - } - } - } -} - -func (p *driver) getEnums() []drivers.Enum { - enums := make([]drivers.Enum, 0, len(p.enums)) - for _, e := range p.enums { - enums = append(enums, e) - } - - sort.Slice(enums, func(i, j int) bool { - return enums[i].Type < enums[j].Type - }) - - return enums -} - -func (d *driver) indexes(table *schema.Table, colFilter drivers.ColumnFilter) []drivers.Index { - var indexes []drivers.Index //nolint:prealloc - - filter := colFilter[d.key(table.Schema.Name, table.Name)] - only := filter.Only - except := filter.Except - - if table.PrimaryKey != nil && len(table.PrimaryKey.Parts) > 0 { - var pkName string - var shouldSkip bool - - cols := make([]string, len(table.PrimaryKey.Parts)) - for i, part := range table.PrimaryKey.Parts { - if part.X != nil || drivers.Skip(part.C.Name, only, except) { - shouldSkip = true - } - cols[i] = part.C.Name - } - pkName = d.makePkName(table) - - if !shouldSkip && pkName != "" { - indexes = append(indexes, drivers.Index{ - Name: pkName, - Columns: cols, - }) - } - } - - for _, index := range table.Indexes { - shouldSkip := false - cols := make([]string, len(index.Parts)) - for i, part := range index.Parts { - if part.X != nil || drivers.Skip(part.C.Name, only, except) { - shouldSkip = true - } - cols[i] = part.C.Name - } - if shouldSkip { - continue - } - indexes = append(indexes, drivers.Index{ - Name: index.Name, - Columns: cols, - }) - } - - return indexes -} - -func (d *driver) makePkName(table *schema.Table) string { - if table.PrimaryKey.Name != "" { - return table.PrimaryKey.Name - } - switch d.Dialect() { - case "psql": - return table.Name + "_pkey" - case "mysql": - return "PRIMARY" - case "sqlite": - isCompositePrimaryKey := len(table.PrimaryKey.Parts) > 1 - isIntegerColumnType := false - typ, ok := table.PrimaryKey.Parts[0].C.Type.Type.(*schema.IntegerType) - if ok { - isIntegerColumnType = typ.T == "integer" - } - if isCompositePrimaryKey || !isIntegerColumnType { - return "sqlite_autoindex_" + table.Name + "_1" - } - } - return "" -} diff --git a/gen/bobgen-atlas/driver/atlas.mysql_golden.json b/gen/bobgen-atlas/driver/atlas.mysql_golden.json deleted file mode 100644 index d3d784ca..00000000 --- a/gen/bobgen-atlas/driver/atlas.mysql_golden.json +++ /dev/null @@ -1,1904 +0,0 @@ -{ - "tables": [ - { - "key": "multi_keys", - "schema": "", - "name": "multi_keys", - "columns": [ - { - "name": "id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int32" - }, - { - "name": "user_id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "sponsor_id", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "something", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "another", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "two", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - } - ], - "indexes": [ - { - "name": "PRIMARY", - "columns": [ - "id" - ], - "expressions": null - }, - { - "name": "one", - "columns": [ - "one", - "two" - ], - "expressions": null - }, - { - "name": "something", - "columns": [ - "something", - "another" - ], - "expressions": null - }, - { - "name": "sponsor_id", - "columns": [ - "sponsor_id" - ], - "expressions": null - } - ], - "constraints": { - "primary": { - "name": "pk_multi_keys", - "columns": [ - "id" - ] - }, - "foreign": [ - { - "name": "fk_multi_keys_0", - "columns": [ - "one", - "two" - ], - "foreign_table": "type_monsters", - "foreign_columns": [ - "int_one", - "int_two" - ] - } - ], - "uniques": [ - { - "name": "something", - "columns": [ - "something", - "another" - ] - }, - { - "name": "sponsor_id", - "columns": [ - "sponsor_id" - ] - } - ] - } - }, - { - "key": "sponsors", - "schema": "", - "name": "sponsors", - "columns": [ - { - "name": "id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int32" - } - ], - "indexes": [ - { - "name": "PRIMARY", - "columns": [ - "id" - ], - "expressions": null - } - ], - "constraints": { - "primary": { - "name": "pk_sponsors", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "tags", - "schema": "", - "name": "tags", - "columns": [ - { - "name": "id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int32" - } - ], - "indexes": [ - { - "name": "PRIMARY", - "columns": [ - "id" - ], - "expressions": null - } - ], - "constraints": { - "primary": { - "name": "pk_tags", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "type_monsters", - "schema": "", - "name": "type_monsters", - "columns": [ - { - "name": "id", - "db_type": "", - "default": "", - "comment": "comment on ID", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int32" - }, - { - "name": "enum_use", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "TypeMonstersEnumUse" - }, - { - "name": "enum_nullable", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "TypeMonstersEnumNullable" - }, - { - "name": "id_two", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "id_three", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "bool_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_two", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_three", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_four", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_five", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_six", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "string_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_two", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_three", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_four", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_five", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_six", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_seven", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_eight", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_nine", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_ten", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_eleven", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "big_int_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_two", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_three", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_four", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_five", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_six", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_seven", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "uint64" - }, - { - "name": "big_int_eight", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "uint64" - }, - { - "name": "int_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "int_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "int_two", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "int_three", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "int_four", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "int_five", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "int_six", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "int_seven", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "uint32" - }, - { - "name": "int_eight", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "uint32" - }, - { - "name": "float_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "float_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "float_two", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "float_three", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "float_four", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "float_five", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "float_six", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "float_seven", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "float_eight", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "float_nine", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "bytea_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_two", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_three", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_four", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_five", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_six", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_seven", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_eight", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "time_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_two", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_three", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_five", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_nine", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_eleven", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_twelve", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_fifteen", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_sixteen", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "json_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "types.JSON[json.RawMessage]" - }, - { - "name": "json_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "types.JSON[json.RawMessage]" - }, - { - "name": "tinyint_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int8" - }, - { - "name": "tinyint_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int8" - }, - { - "name": "tinyint1_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "tinyint1_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "tinyint2_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int8" - }, - { - "name": "tinyint2_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int8" - }, - { - "name": "smallint_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int16" - }, - { - "name": "smallint_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int16" - }, - { - "name": "mediumint_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "mediumint_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "bigint_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "bigint_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "float_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "float_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "double_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float64" - }, - { - "name": "double_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float64" - }, - { - "name": "doubleprec_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float64" - }, - { - "name": "doubleprec_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float64" - }, - { - "name": "real_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float64" - }, - { - "name": "real_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float64" - }, - { - "name": "boolean_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "boolean_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "date_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "date_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "datetime_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "datetime_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "timestamp_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "timestamp_nnull", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "binary_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "binary_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "varbinary_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "varbinary_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "tinyblob_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "tinyblob_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "blob_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "blob_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "mediumblob_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "mediumblob_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "longblob_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "longblob_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "varchar_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "varchar_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "char_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "char_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "text_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "text_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "virtual_nnull", - "db_type": "", - "default": "GENERATED", - "comment": "", - "nullable": false, - "generated": true, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "virtual_null", - "db_type": "", - "default": "GENERATED", - "comment": "", - "nullable": true, - "generated": true, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "generated_nnull", - "db_type": "", - "default": "GENERATED", - "comment": "", - "nullable": false, - "generated": true, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "generated_null", - "db_type": "", - "default": "GENERATED", - "comment": "", - "nullable": true, - "generated": true, - "autoincr": false, - "domain_name": "", - "type": "string" - } - ], - "indexes": [ - { - "name": "PRIMARY", - "columns": [ - "id" - ], - "expressions": null - }, - { - "name": "int_one", - "columns": [ - "int_one", - "int_two" - ], - "expressions": null - } - ], - "constraints": { - "primary": { - "name": "pk_type_monsters", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "user_videos", - "schema": "", - "name": "user_videos", - "columns": [ - { - "name": "user_id", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "video_id", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "sponsor_id", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - } - ], - "indexes": null, - "constraints": { - "primary": null, - "foreign": null, - "uniques": null - } - }, - { - "key": "users", - "schema": "", - "name": "users", - "columns": [ - { - "name": "id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int32" - } - ], - "indexes": [ - { - "name": "PRIMARY", - "columns": [ - "id" - ], - "expressions": null - } - ], - "constraints": { - "primary": { - "name": "pk_users", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "video_tags", - "schema": "", - "name": "video_tags", - "columns": [ - { - "name": "video_id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "tag_id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - } - ], - "indexes": [ - { - "name": "PRIMARY", - "columns": [ - "video_id", - "tag_id" - ], - "expressions": null - }, - { - "name": "tag_id", - "columns": [ - "tag_id" - ], - "expressions": null - } - ], - "constraints": { - "primary": { - "name": "pk_video_tags", - "columns": [ - "video_id", - "tag_id" - ] - }, - "foreign": [ - { - "name": "fk_video_tags_0", - "columns": [ - "video_id" - ], - "foreign_table": "videos", - "foreign_columns": [ - "id" - ] - }, - { - "name": "fk_video_tags_1", - "columns": [ - "tag_id" - ], - "foreign_table": "tags", - "foreign_columns": [ - "id" - ] - } - ], - "uniques": null - } - }, - { - "key": "videos", - "schema": "", - "name": "videos", - "columns": [ - { - "name": "id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int32" - }, - { - "name": "user_id", - "db_type": "", - "default": "", - "comment": "this is a comment", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "sponsor_id", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - } - ], - "indexes": [ - { - "name": "PRIMARY", - "columns": [ - "id" - ], - "expressions": null - }, - { - "name": "sponsor_id", - "columns": [ - "sponsor_id" - ], - "expressions": null - }, - { - "name": "user_id", - "columns": [ - "user_id" - ], - "expressions": null - } - ], - "constraints": { - "primary": { - "name": "pk_videos", - "columns": [ - "id" - ] - }, - "foreign": [ - { - "name": "fk_videos_0", - "columns": [ - "user_id" - ], - "foreign_table": "users", - "foreign_columns": [ - "id" - ] - }, - { - "name": "fk_videos_1", - "columns": [ - "sponsor_id" - ], - "foreign_table": "sponsors", - "foreign_columns": [ - "id" - ] - } - ], - "uniques": [ - { - "name": "sponsor_id", - "columns": [ - "sponsor_id" - ] - } - ] - } - } - ], - "enums": [ - { - "Type": "TypeMonstersEnumNullable", - "Values": [ - "monday", - "tuesday", - "wednesday", - "thursday", - "friday" - ] - }, - { - "Type": "TypeMonstersEnumUse", - "Values": [ - "monday", - "tuesday", - "wednesday", - "thursday", - "friday" - ] - } - ], - "extra_info": null, - "driver_name": "" -} \ No newline at end of file diff --git a/gen/bobgen-atlas/driver/atlas.psql_golden.json b/gen/bobgen-atlas/driver/atlas.psql_golden.json deleted file mode 100644 index 80340814..00000000 --- a/gen/bobgen-atlas/driver/atlas.psql_golden.json +++ /dev/null @@ -1,2127 +0,0 @@ -{ - "tables": [ - { - "key": "sponsors", - "schema": "", - "name": "sponsors", - "columns": [ - { - "name": "id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - } - ], - "indexes": [ - { - "name": "sponsors_pkey", - "columns": [ - "id" - ], - "expressions": null - } - ], - "constraints": { - "primary": { - "name": "pk_sponsors", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "tags", - "schema": "", - "name": "tags", - "columns": [ - { - "name": "id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - } - ], - "indexes": [ - { - "name": "tags_pkey", - "columns": [ - "id" - ], - "expressions": null - } - ], - "constraints": { - "primary": { - "name": "pk_tags", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "type_monsters", - "schema": "", - "name": "type_monsters", - "columns": [ - { - "name": "id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "enum_use", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "Workday" - }, - { - "name": "enum_nullable", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "Workday" - }, - { - "name": "bool_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_two", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_three", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_four", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_five", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_six", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "string_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_two", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_three", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_four", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_five", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_six", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_seven", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_eight", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_nine", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_ten", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_eleven", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_two", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_three", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_four", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_five", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_six", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_seven", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_eight", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_nine", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "byte_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "byte_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "byte_two", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "byte_three", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "byte_four", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "big_int_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_two", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_three", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_four", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_five", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_six", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "int_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "int_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "int_two", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "int_three", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "int_four", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "int_five", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "int_six", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "float_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_two", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_three", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_four", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_five", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_six", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_seven", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_eight", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_nine", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "bytea_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_two", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_three", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_four", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_five", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_six", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_seven", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_eight", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "time_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_two", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_three", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_four", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_five", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_six", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_seven", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_eight", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_nine", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_ten", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_eleven", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_twelve", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_thirteen", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_fourteen", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_fifteen", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_sixteen", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_seventeen", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_eighteen", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "uuid_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "uuid.UUID" - }, - { - "name": "uuid_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "uuid.UUID" - }, - { - "name": "uuid_two", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "uuid.UUID" - }, - { - "name": "uuid_three", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "uuid.UUID" - }, - { - "name": "uuid_four", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "uuid.UUID" - }, - { - "name": "uuid_five", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "uuid.UUID" - }, - { - "name": "integer_default", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "varchar_default", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "timestamp_notz", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "timestamp_tz", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "interval_nnull", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "interval_null", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "json_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "types.JSON[json.RawMessage]" - }, - { - "name": "json_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "types.JSON[json.RawMessage]" - }, - { - "name": "jsonb_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "types.JSON[json.RawMessage]" - }, - { - "name": "jsonb_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "types.JSON[json.RawMessage]" - }, - { - "name": "box_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgeo.Box" - }, - { - "name": "box_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgeo.Box" - }, - { - "name": "cidr_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "cidr_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "circle_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgeo.Circle" - }, - { - "name": "circle_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgeo.Circle" - }, - { - "name": "double_prec_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float64" - }, - { - "name": "double_prec_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float64" - }, - { - "name": "inet_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "inet_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "line_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgeo.Line" - }, - { - "name": "line_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgeo.Line" - }, - { - "name": "lseg_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgeo.Lseg" - }, - { - "name": "lseg_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgeo.Lseg" - }, - { - "name": "macaddr_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "macaddr_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "money_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "money_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "path_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgeo.Path" - }, - { - "name": "path_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgeo.Path" - }, - { - "name": "pg_lsn_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "pg_lsn_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "point_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgeo.Point" - }, - { - "name": "point_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgeo.Point" - }, - { - "name": "polygon_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgeo.Polygon" - }, - { - "name": "polygon_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgeo.Polygon" - }, - { - "name": "tsquery_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "tsquery_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "tsvector_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "tsvector_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "txid_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "txid_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "xml_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "xml_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "intarr_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.Int64Array" - }, - { - "name": "intarr_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.Int64Array" - }, - { - "name": "boolarr_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.BoolArray" - }, - { - "name": "boolarr_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.BoolArray" - }, - { - "name": "varchararr_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.StringArray" - }, - { - "name": "varchararr_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.StringArray" - }, - { - "name": "decimalarr_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[decimal.Decimal]" - }, - { - "name": "decimalarr_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[decimal.Decimal]" - }, - { - "name": "byteaarr_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.ByteaArray" - }, - { - "name": "byteaarr_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.ByteaArray" - }, - { - "name": "jsonbarr_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[types.JSON[json.RawMessage]]" - }, - { - "name": "jsonbarr_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[types.JSON[json.RawMessage]]" - }, - { - "name": "jsonarr_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[types.JSON[json.RawMessage]]" - }, - { - "name": "jsonarr_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[types.JSON[json.RawMessage]]" - }, - { - "name": "enumarr_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.EnumArray[Workday]" - }, - { - "name": "enumarr_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.EnumArray[Workday]" - }, - { - "name": "customarr_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "customarr_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "domainuint3_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "base", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "generated_nnull", - "db_type": "", - "default": "GENERATED", - "comment": "", - "nullable": false, - "generated": true, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "generated_null", - "db_type": "", - "default": "GENERATED", - "comment": "", - "nullable": true, - "generated": true, - "autoincr": false, - "domain_name": "", - "type": "string" - } - ], - "indexes": [ - { - "name": "type_monsters_pkey", - "columns": [ - "id" - ], - "expressions": null - } - ], - "constraints": { - "primary": { - "name": "pk_type_monsters", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "users", - "schema": "", - "name": "users", - "columns": [ - { - "name": "id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "email_validated", - "db_type": "", - "default": "DEFAULT", - "comment": "Has the email address been tested?", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "primary_email", - "db_type": "", - "default": "NULL", - "comment": "The user's preferred email address.\n\nUse this to send emails to the user.", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - } - ], - "indexes": [ - { - "name": "users_pkey", - "columns": [ - "id" - ], - "expressions": null - }, - { - "name": "users_primary_email_key", - "columns": [ - "primary_email" - ], - "expressions": null - } - ], - "constraints": { - "primary": { - "name": "pk_users", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": [ - { - "name": "users_primary_email_key", - "columns": [ - "primary_email" - ] - } - ] - } - }, - { - "key": "video_tags", - "schema": "", - "name": "video_tags", - "columns": [ - { - "name": "video_id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "tag_id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - } - ], - "indexes": [ - { - "name": "video_tags_pkey", - "columns": [ - "video_id", - "tag_id" - ], - "expressions": null - } - ], - "constraints": { - "primary": { - "name": "pk_video_tags", - "columns": [ - "video_id", - "tag_id" - ] - }, - "foreign": [ - { - "name": "fk_video_tags_0", - "columns": [ - "tag_id" - ], - "foreign_table": "tags", - "foreign_columns": [ - "id" - ] - }, - { - "name": "fk_video_tags_1", - "columns": [ - "video_id" - ], - "foreign_table": "videos", - "foreign_columns": [ - "id" - ] - } - ], - "uniques": null - } - }, - { - "key": "videos", - "schema": "", - "name": "videos", - "columns": [ - { - "name": "id", - "db_type": "", - "default": "", - "comment": "The ID of the video", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "user_id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "sponsor_id", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - } - ], - "indexes": [ - { - "name": "videos_pkey", - "columns": [ - "id" - ], - "expressions": null - }, - { - "name": "videos_sponsor_id_key", - "columns": [ - "sponsor_id" - ], - "expressions": null - } - ], - "constraints": { - "primary": { - "name": "pk_videos", - "columns": [ - "id" - ] - }, - "foreign": [ - { - "name": "fk_videos_0", - "columns": [ - "sponsor_id" - ], - "foreign_table": "sponsors", - "foreign_columns": [ - "id" - ] - }, - { - "name": "fk_videos_1", - "columns": [ - "user_id" - ], - "foreign_table": "users", - "foreign_columns": [ - "id" - ] - } - ], - "uniques": [ - { - "name": "videos_sponsor_id_key", - "columns": [ - "sponsor_id" - ] - } - ] - } - } - ], - "enums": [ - { - "Type": "Workday", - "Values": [ - "monday", - "tuesday", - "wednesday", - "thursday", - "friday" - ] - } - ], - "extra_info": null, - "driver_name": "" -} \ No newline at end of file diff --git a/gen/bobgen-atlas/driver/atlas.sqlite_golden.json b/gen/bobgen-atlas/driver/atlas.sqlite_golden.json deleted file mode 100644 index fa407d35..00000000 --- a/gen/bobgen-atlas/driver/atlas.sqlite_golden.json +++ /dev/null @@ -1,1770 +0,0 @@ -{ - "tables": [ - { - "key": "autoinckeywordtest", - "schema": "", - "name": "autoinckeywordtest", - "columns": [ - { - "name": "id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int32" - }, - { - "name": "user_id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "sponsor_id", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "something", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "another", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - } - ], - "indexes": [ - { - "name": "autoinckeywordtest_sponsor_id", - "columns": [ - "sponsor_id" - ], - "expressions": null - }, - { - "name": "autoinckeywordtest_something_another", - "columns": [ - "something", - "another" - ], - "expressions": null - } - ], - "constraints": { - "primary": { - "name": "pk_autoinckeywordtest", - "columns": [ - "id" - ] - }, - "foreign": [ - { - "name": "fk_autoinckeywordtest_0", - "columns": [ - "user_id", - "sponsor_id" - ], - "foreign_table": "videos", - "foreign_columns": [ - "user_id", - "sponsor_id" - ] - } - ], - "uniques": [ - { - "name": "autoinckeywordtest_sponsor_id", - "columns": [ - "sponsor_id" - ] - }, - { - "name": "autoinckeywordtest_something_another", - "columns": [ - "something", - "another" - ] - } - ] - } - }, - { - "key": "autoinctest", - "schema": "", - "name": "autoinctest", - "columns": [ - { - "name": "id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - } - ], - "indexes": null, - "constraints": { - "primary": { - "name": "pk_autoinctest", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "has_generated_columns", - "schema": "", - "name": "has_generated_columns", - "columns": [ - { - "name": "a", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "b", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "c", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "d", - "db_type": "", - "default": "GENERATED", - "comment": "", - "nullable": true, - "generated": true, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "e", - "db_type": "", - "default": "GENERATED", - "comment": "", - "nullable": true, - "generated": true, - "autoincr": false, - "domain_name": "", - "type": "string" - } - ], - "indexes": null, - "constraints": { - "primary": { - "name": "pk_has_generated_columns", - "columns": [ - "a" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "sponsors", - "schema": "", - "name": "sponsors", - "columns": [ - { - "name": "id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - } - ], - "indexes": [ - { - "name": "sqlite_autoindex_sponsors_1", - "columns": [ - "id" - ], - "expressions": null - } - ], - "constraints": { - "primary": { - "name": "pk_sponsors", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "tags", - "schema": "", - "name": "tags", - "columns": [ - { - "name": "id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - } - ], - "indexes": [ - { - "name": "sqlite_autoindex_tags_1", - "columns": [ - "id" - ], - "expressions": null - } - ], - "constraints": { - "primary": { - "name": "pk_tags", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "type_monsters", - "schema": "", - "name": "type_monsters", - "columns": [ - { - "name": "id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "id_two", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "id_three", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "bool_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_two", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_three", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_four", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_five", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_six", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "string_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_two", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_three", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_four", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_five", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_six", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_seven", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_eight", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_nine", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_ten", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_eleven", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "big_int_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_two", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_three", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_four", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_five", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_six", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "int_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "int_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "int_two", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "int_three", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "int_four", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "int_five", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "int_six", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "float_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "float_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "float_two", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "float_three", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "float_four", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "float_five", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "float_six", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "float_seven", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "float_eight", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "float_nine", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "bytea_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "bytea_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "bytea_two", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "bytea_three", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "bytea_four", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "bytea_five", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "bytea_six", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "bytea_seven", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "bytea_eight", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "time_zero", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_one", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_two", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_three", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_five", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_nine", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_eleven", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_twelve", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_fifteen", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_sixteen", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "json_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "types.JSON[json.RawMessage]" - }, - { - "name": "json_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "types.JSON[json.RawMessage]" - }, - { - "name": "tinyint_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int8" - }, - { - "name": "tinyint_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int8" - }, - { - "name": "tinyint1_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int8" - }, - { - "name": "tinyint1_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int8" - }, - { - "name": "tinyint2_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int8" - }, - { - "name": "tinyint2_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int8" - }, - { - "name": "smallint_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int16" - }, - { - "name": "smallint_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int16" - }, - { - "name": "mediumint_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "mediumint_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "bigint_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "bigint_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "float_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "float_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "double_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float64" - }, - { - "name": "double_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float64" - }, - { - "name": "doubleprec_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float64" - }, - { - "name": "doubleprec_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float64" - }, - { - "name": "real_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "real_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float32" - }, - { - "name": "boolean_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "boolean_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "date_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "date_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "datetime_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "datetime_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "timestamp_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "timestamp_nnull", - "db_type": "", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "binary_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "binary_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "varbinary_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "varbinary_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "tinyblob_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "tinyblob_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "blob_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "blob_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "mediumblob_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "mediumblob_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "longblob_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "longblob_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "varchar_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "varchar_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "char_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "char_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "text_null", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "text_nnull", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - } - ], - "indexes": [ - { - "name": "sqlite_autoindex_type_monsters_1", - "columns": [ - "id" - ], - "expressions": null - } - ], - "constraints": { - "primary": { - "name": "pk_type_monsters", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "users", - "schema": "", - "name": "users", - "columns": [ - { - "name": "id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - } - ], - "indexes": [ - { - "name": "sqlite_autoindex_users_1", - "columns": [ - "id" - ], - "expressions": null - } - ], - "constraints": { - "primary": { - "name": "pk_users", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "video_tags", - "schema": "", - "name": "video_tags", - "columns": [ - { - "name": "video_id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "tag_id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - } - ], - "indexes": [ - { - "name": "sqlite_autoindex_video_tags_1", - "columns": [ - "video_id", - "tag_id" - ], - "expressions": null - } - ], - "constraints": { - "primary": { - "name": "pk_video_tags", - "columns": [ - "video_id", - "tag_id" - ] - }, - "foreign": [ - { - "name": "fk_video_tags_0", - "columns": [ - "tag_id" - ], - "foreign_table": "tags", - "foreign_columns": [ - "id" - ] - }, - { - "name": "fk_video_tags_1", - "columns": [ - "video_id" - ], - "foreign_table": "videos", - "foreign_columns": [ - "id" - ] - } - ], - "uniques": null - } - }, - { - "key": "videos", - "schema": "", - "name": "videos", - "columns": [ - { - "name": "id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "user_id", - "db_type": "", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - }, - { - "name": "sponsor_id", - "db_type": "", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int32" - } - ], - "indexes": [ - { - "name": "sqlite_autoindex_videos_1", - "columns": [ - "id" - ], - "expressions": null - }, - { - "name": "videos_sponsor_id", - "columns": [ - "sponsor_id" - ], - "expressions": null - } - ], - "constraints": { - "primary": { - "name": "pk_videos", - "columns": [ - "id" - ] - }, - "foreign": [ - { - "name": "fk_videos_0", - "columns": [ - "sponsor_id" - ], - "foreign_table": "sponsors", - "foreign_columns": [ - "id" - ] - }, - { - "name": "fk_videos_1", - "columns": [ - "user_id" - ], - "foreign_table": "users", - "foreign_columns": [ - "id" - ] - } - ], - "uniques": [ - { - "name": "videos_sponsor_id", - "columns": [ - "sponsor_id" - ] - } - ] - } - } - ], - "enums": [], - "extra_info": null, - "driver_name": "" -} \ No newline at end of file diff --git a/gen/bobgen-atlas/driver/atlas_test.go b/gen/bobgen-atlas/driver/atlas_test.go deleted file mode 100644 index af6b8942..00000000 --- a/gen/bobgen-atlas/driver/atlas_test.go +++ /dev/null @@ -1,98 +0,0 @@ -package driver - -import ( - "embed" - _ "embed" - "flag" - "fmt" - "io/fs" - "os" - "testing" - - _ "github.com/jackc/pgx/v5/stdlib" - "github.com/stephenafamo/bob/gen" - helpers "github.com/stephenafamo/bob/gen/bobgen-helpers" - "github.com/stephenafamo/bob/gen/drivers" - testgen "github.com/stephenafamo/bob/test/gen" -) - -//go:embed test_schema -var testSchema embed.FS - -var flagOverwriteGolden = flag.Bool("overwrite-golden", false, "Overwrite the golden file with the current execution results") - -type testCase struct { - name string - config Config - goldenJson string - schema fs.FS - modelTemplates fs.FS -} - -func TestPostgres(t *testing.T) { - psqlSchemas, _ := fs.Sub(testSchema, "test_schema/psql") - psqlCase := testCase{ - name: "psql", - config: Config{ - Dialect: "psql", - }, - schema: psqlSchemas, - goldenJson: "atlas.psql_golden.json", - } - testDialect(t, psqlCase) -} - -func TestMySQL(t *testing.T) { - mysqlSchemas, _ := fs.Sub(testSchema, "test_schema/mysql") - mysqlCase := testCase{ - name: "mysql", - config: Config{ - Dialect: "mysql", - }, - schema: mysqlSchemas, - goldenJson: "atlas.mysql_golden.json", - modelTemplates: gen.MySQLModelTemplates, - } - testDialect(t, mysqlCase) -} - -func TestSQLite(t *testing.T) { - sqliteSchemas, _ := fs.Sub(testSchema, "test_schema/sqlite") - sqliteCase := testCase{ - name: "sqlite", - config: Config{ - Dialect: "sqlite", - }, - schema: sqliteSchemas, - goldenJson: "atlas.sqlite_golden.json", - modelTemplates: gen.SQLiteModelTemplates, - } - testDialect(t, sqliteCase) -} - -func testDialect(t *testing.T, tt testCase) { - t.Helper() - out, err := os.MkdirTemp("", fmt.Sprintf("bobgen_atlas_%s_", tt.name)) - if err != nil { - t.Fatalf("unable to create tempdir: %s", err) - } - - // Defer cleanup of the tmp folder - defer func() { - if t.Failed() { - t.Log("template test output:", out) - return - } - os.RemoveAll(out) - }() - - testgen.TestDriver(t, testgen.DriverTestConfig[any]{ - Root: out, - GetDriver: func() drivers.Interface[any] { - return New(tt.config, tt.schema) - }, - GoldenFile: tt.goldenJson, - OverwriteGolden: *flagOverwriteGolden, - Templates: &helpers.Templates{Models: []fs.FS{tt.modelTemplates}}, - }) -} diff --git a/gen/bobgen-atlas/driver/copied.go b/gen/bobgen-atlas/driver/copied.go deleted file mode 100644 index 3237aa60..00000000 --- a/gen/bobgen-atlas/driver/copied.go +++ /dev/null @@ -1,63 +0,0 @@ -package driver - -import ( - "fmt" - "io/fs" - "path/filepath" - - "github.com/hashicorp/hcl/v2" - "github.com/hashicorp/hcl/v2/hclparse" - "github.com/hashicorp/hcl/v2/hclsyntax" -) - -func parseHCLPaths(files fs.FS) (*hclparse.Parser, error) { - p := hclparse.NewParser() - - dir, err := fs.ReadDir(files, ".") - if err != nil { - return nil, err - } - for _, f := range dir { - // Skip nested dirs. - if f.IsDir() { - continue - } - if err := mayParse(p, files, f.Name()); err != nil { - return nil, err - } - } - - if len(p.Files()) == 0 { - return nil, fmt.Errorf("no schema files found") - } - return p, nil -} - -// mayParse will parse the file in path if it is an HCL file. If the file is an Atlas -// project file an error is returned. -func mayParse(p *hclparse.Parser, f fs.FS, path string) error { - if n := filepath.Base(path); filepath.Ext(n) != ".hcl" { - return nil - } - fileContents, err := fs.ReadFile(f, path) - if err != nil { - return err - } - switch f, diag := p.ParseHCL(fileContents, path); { - case diag.HasErrors(): - return diag - case isProjectFile(f): - return fmt.Errorf("cannot parse project file %q as a schema file", path) - default: - return nil - } -} - -func isProjectFile(f *hcl.File) bool { - for _, blk := range f.Body.(*hclsyntax.Body).Blocks { - if blk.Type == "env" { - return true - } - } - return false -} diff --git a/gen/bobgen-atlas/driver/test_schema/mysql/schema.hcl b/gen/bobgen-atlas/driver/test_schema/mysql/schema.hcl deleted file mode 100644 index 23b002a6..00000000 --- a/gen/bobgen-atlas/driver/test_schema/mysql/schema.hcl +++ /dev/null @@ -1,739 +0,0 @@ -table "multi_keys" { - schema = schema.bob_droppable - column "id" { - null = false - type = int - auto_increment = true - } - column "user_id" { - null = false - type = int - } - column "sponsor_id" { - null = true - type = int - } - column "something" { - null = true - type = int - } - column "another" { - null = true - type = int - } - column "one" { - null = true - type = int - } - column "two" { - null = false - type = int - } - primary_key { - columns = [column.id] - } - foreign_key "multi_keys_ibfk_1" { - columns = [column.one, column.two] - ref_columns = [table.type_monsters.column.int_one, table.type_monsters.column.int_two] - on_update = NO_ACTION - on_delete = NO_ACTION - } - index "one" { - columns = [column.one, column.two] - } - index "something" { - unique = true - columns = [column.something, column.another] - } - index "sponsor_id" { - unique = true - columns = [column.sponsor_id] - } -} -table "sponsors" { - schema = schema.bob_droppable - column "id" { - null = false - type = int - auto_increment = true - } - primary_key { - columns = [column.id] - } -} -table "tags" { - schema = schema.bob_droppable - column "id" { - null = false - type = int - auto_increment = true - } - primary_key { - columns = [column.id] - } -} -table "type_monsters" { - schema = schema.bob_droppable - column "id" { - null = false - type = int - comment = "comment on ID" - auto_increment = true - } - column "enum_use" { - null = false - type = enum("monday","tuesday","wednesday","thursday","friday") - } - column "enum_nullable" { - null = true - type = enum("monday","tuesday","wednesday","thursday","friday") - } - column "id_two" { - null = false - type = int - } - column "id_three" { - null = true - type = int - } - column "bool_zero" { - null = true - type = bool - } - column "bool_one" { - null = true - type = bool - } - column "bool_two" { - null = false - type = bool - } - column "bool_three" { - null = true - type = bool - default = 0 - } - column "bool_four" { - null = true - type = bool - default = 1 - } - column "bool_five" { - null = false - type = bool - default = 0 - } - column "bool_six" { - null = false - type = bool - default = 1 - } - column "string_zero" { - null = true - type = varchar(1) - } - column "string_one" { - null = true - type = varchar(1) - } - column "string_two" { - null = false - type = varchar(1) - } - column "string_three" { - null = true - type = varchar(1) - default = "a" - } - column "string_four" { - null = false - type = varchar(1) - default = "b" - } - column "string_five" { - null = true - type = varchar(1000) - } - column "string_six" { - null = true - type = varchar(1000) - } - column "string_seven" { - null = false - type = varchar(1000) - } - column "string_eight" { - null = true - type = varchar(1000) - default = "abcdefgh" - } - column "string_nine" { - null = false - type = varchar(1000) - default = "abcdefgh" - } - column "string_ten" { - null = true - type = varchar(1000) - default = "" - } - column "string_eleven" { - null = false - type = varchar(1000) - default = "" - } - column "big_int_zero" { - null = true - type = bigint - } - column "big_int_one" { - null = true - type = bigint - } - column "big_int_two" { - null = false - type = bigint - } - column "big_int_three" { - null = true - type = bigint - default = 111111 - } - column "big_int_four" { - null = false - type = bigint - default = 222222 - } - column "big_int_five" { - null = true - type = bigint - default = 0 - } - column "big_int_six" { - null = false - type = bigint - default = 0 - } - column "big_int_seven" { - null = false - type = bigint - unsigned = true - } - column "big_int_eight" { - null = true - type = bigint - unsigned = true - } - column "int_zero" { - null = true - type = int - } - column "int_one" { - null = true - type = int - } - column "int_two" { - null = false - type = int - } - column "int_three" { - null = true - type = int - default = 333333 - } - column "int_four" { - null = false - type = int - default = 444444 - } - column "int_five" { - null = true - type = int - default = 0 - } - column "int_six" { - null = false - type = int - default = 0 - } - column "int_seven" { - null = false - type = int - unsigned = true - } - column "int_eight" { - null = true - type = int - unsigned = true - } - column "float_zero" { - null = true - type = float - } - column "float_one" { - null = true - type = float - } - column "float_two" { - null = true - type = float(2) - unsigned = false - } - column "float_three" { - null = true - type = float(2) - unsigned = false - } - column "float_four" { - null = true - type = float(2) - unsigned = false - } - column "float_five" { - null = false - type = float(2) - unsigned = false - } - column "float_six" { - null = true - type = float(2) - default = 1.1 - unsigned = false - } - column "float_seven" { - null = false - type = float(2) - default = 1.1 - unsigned = false - } - column "float_eight" { - null = true - type = float(2) - default = 0 - unsigned = false - } - column "float_nine" { - null = true - type = float(2) - default = 0 - unsigned = false - } - column "bytea_zero" { - null = true - type = binary(1) - } - column "bytea_one" { - null = true - type = binary(1) - } - column "bytea_two" { - null = false - type = binary(1) - } - column "bytea_three" { - null = false - type = binary(1) - default = sql("0x61") - } - column "bytea_four" { - null = true - type = binary(1) - default = sql("0x62") - } - column "bytea_five" { - null = false - type = binary(100) - default = sql("0x616263646566676861626364656667686162636465666768") - } - column "bytea_six" { - null = true - type = binary(100) - default = sql("0x686766656463626168676665646362616867666564636261") - } - column "bytea_seven" { - null = false - type = binary(1) - default = sql("0x0") - } - column "bytea_eight" { - null = false - type = binary(1) - default = sql("0x0") - } - column "time_zero" { - null = true - type = timestamp - } - column "time_one" { - null = true - type = date - } - column "time_two" { - null = true - type = timestamp - } - column "time_three" { - null = true - type = timestamp - } - column "time_five" { - null = true - type = timestamp - default = sql("CURRENT_TIMESTAMP") - } - column "time_nine" { - null = false - type = timestamp - default = sql("CURRENT_TIMESTAMP") - } - column "time_eleven" { - null = true - type = date - } - column "time_twelve" { - null = false - type = date - } - column "time_fifteen" { - null = true - type = date - default = "1999-01-08" - } - column "time_sixteen" { - null = false - type = date - default = "1999-01-08" - } - column "json_null" { - null = true - type = json - } - column "json_nnull" { - null = false - type = json - } - column "tinyint_null" { - null = true - type = tinyint - } - column "tinyint_nnull" { - null = false - type = tinyint - } - column "tinyint1_null" { - null = true - type = bool - } - column "tinyint1_nnull" { - null = false - type = bool - } - column "tinyint2_null" { - null = true - type = tinyint - } - column "tinyint2_nnull" { - null = false - type = tinyint - } - column "smallint_null" { - null = true - type = smallint - } - column "smallint_nnull" { - null = false - type = smallint - } - column "mediumint_null" { - null = true - type = mediumint - } - column "mediumint_nnull" { - null = false - type = mediumint - } - column "bigint_null" { - null = true - type = bigint - } - column "bigint_nnull" { - null = false - type = bigint - } - column "float_null" { - null = true - type = float - } - column "float_nnull" { - null = false - type = float - } - column "double_null" { - null = true - type = double - } - column "double_nnull" { - null = false - type = double - } - column "doubleprec_null" { - null = true - type = double - } - column "doubleprec_nnull" { - null = false - type = double - } - column "real_null" { - null = true - type = double - } - column "real_nnull" { - null = false - type = double - } - column "boolean_null" { - null = true - type = bool - } - column "boolean_nnull" { - null = false - type = bool - } - column "date_null" { - null = true - type = date - } - column "date_nnull" { - null = false - type = date - } - column "datetime_null" { - null = true - type = datetime - } - column "datetime_nnull" { - null = false - type = datetime - } - column "timestamp_null" { - null = true - type = timestamp - } - column "timestamp_nnull" { - null = false - type = timestamp - default = sql("CURRENT_TIMESTAMP") - } - column "binary_null" { - null = true - type = binary(1) - } - column "binary_nnull" { - null = false - type = binary(1) - } - column "varbinary_null" { - null = true - type = varbinary(100) - } - column "varbinary_nnull" { - null = false - type = varbinary(100) - } - column "tinyblob_null" { - null = true - type = tinyblob - } - column "tinyblob_nnull" { - null = false - type = tinyblob - } - column "blob_null" { - null = true - type = blob - } - column "blob_nnull" { - null = false - type = blob - } - column "mediumblob_null" { - null = true - type = mediumblob - } - column "mediumblob_nnull" { - null = false - type = mediumblob - } - column "longblob_null" { - null = true - type = longblob - } - column "longblob_nnull" { - null = false - type = longblob - } - column "varchar_null" { - null = true - type = varchar(100) - } - column "varchar_nnull" { - null = false - type = varchar(100) - } - column "char_null" { - null = true - type = char(1) - } - column "char_nnull" { - null = false - type = char(1) - } - column "text_null" { - null = true - type = text - } - column "text_nnull" { - null = false - type = text - } - column "virtual_nnull" { - null = false - type = text - as { - expr = "upper(`text_nnull`)" - type = VIRTUAL - } - } - column "virtual_null" { - null = true - type = text - as { - expr = "upper(`text_null`)" - type = VIRTUAL - } - } - column "generated_nnull" { - null = false - type = text - as { - expr = "upper(`text_nnull`)" - type = STORED - } - } - column "generated_null" { - null = true - type = text - as { - expr = "upper(`text_null`)" - type = STORED - } - } - primary_key { - columns = [column.id] - } - index "int_one" { - columns = [column.int_one, column.int_two] - } -} -table "user_videos" { - schema = schema.bob_droppable - comment = "VIEW" - column "user_id" { - null = false - type = int - default = 0 - } - column "video_id" { - null = false - type = int - default = 0 - } - column "sponsor_id" { - null = true - type = int - } -} -table "users" { - schema = schema.bob_droppable - column "id" { - null = false - type = int - auto_increment = true - } - primary_key { - columns = [column.id] - } -} -table "video_tags" { - schema = schema.bob_droppable - column "video_id" { - null = false - type = int - } - column "tag_id" { - null = false - type = int - } - primary_key { - columns = [column.video_id, column.tag_id] - } - foreign_key "video_tags_ibfk_1" { - columns = [column.video_id] - ref_columns = [table.videos.column.id] - on_update = NO_ACTION - on_delete = NO_ACTION - } - foreign_key "video_tags_ibfk_2" { - columns = [column.tag_id] - ref_columns = [table.tags.column.id] - on_update = NO_ACTION - on_delete = NO_ACTION - } - index "tag_id" { - columns = [column.tag_id] - } -} -table "videos" { - schema = schema.bob_droppable - column "id" { - null = false - type = int - auto_increment = true - } - column "user_id" { - null = false - type = int - comment = "this is a comment" - } - column "sponsor_id" { - null = true - type = int - } - primary_key { - columns = [column.id] - } - foreign_key "videos_ibfk_1" { - columns = [column.user_id] - ref_columns = [table.users.column.id] - on_update = NO_ACTION - on_delete = NO_ACTION - } - foreign_key "videos_ibfk_2" { - columns = [column.sponsor_id] - ref_columns = [table.sponsors.column.id] - on_update = NO_ACTION - on_delete = NO_ACTION - } - index "sponsor_id" { - unique = true - columns = [column.sponsor_id] - } - index "user_id" { - columns = [column.user_id] - } -} -schema "bob_droppable" { - charset = "utf8mb4" - collate = "utf8mb4_0900_ai_ci" -} diff --git a/gen/bobgen-atlas/driver/test_schema/psql/schema.hcl b/gen/bobgen-atlas/driver/test_schema/psql/schema.hcl deleted file mode 100644 index 1ae48e95..00000000 --- a/gen/bobgen-atlas/driver/test_schema/psql/schema.hcl +++ /dev/null @@ -1,836 +0,0 @@ -table "sponsors" { - schema = schema.public - column "id" { - null = false - type = serial - } - primary_key { - columns = [column.id] - } -} -table "tags" { - schema = schema.public - column "id" { - null = false - type = serial - } - primary_key { - columns = [column.id] - } -} -table "type_monsters" { - schema = schema.public - column "id" { - null = false - type = serial - } - column "enum_use" { - null = false - type = enum.workday - } - column "enum_nullable" { - null = true - type = enum.workday - } - column "bool_zero" { - null = true - type = boolean - } - column "bool_one" { - null = true - type = boolean - } - column "bool_two" { - null = false - type = boolean - } - column "bool_three" { - null = true - type = boolean - default = false - } - column "bool_four" { - null = true - type = boolean - default = true - } - column "bool_five" { - null = false - type = boolean - default = false - } - column "bool_six" { - null = false - type = boolean - default = true - } - column "string_zero" { - null = true - type = character_varying(1) - } - column "string_one" { - null = true - type = character_varying(1) - } - column "string_two" { - null = false - type = character_varying(1) - } - column "string_three" { - null = true - type = character_varying(1) - default = "a" - } - column "string_four" { - null = false - type = character_varying(1) - default = "b" - } - column "string_five" { - null = true - type = character_varying(1000) - } - column "string_six" { - null = true - type = character_varying(1000) - } - column "string_seven" { - null = false - type = character_varying(1000) - } - column "string_eight" { - null = true - type = character_varying(1000) - default = "abcdefgh" - } - column "string_nine" { - null = false - type = character_varying(1000) - default = "abcdefgh" - } - column "string_ten" { - null = true - type = character_varying(1000) - default = "" - } - column "string_eleven" { - null = false - type = character_varying(1000) - default = "" - } - column "nonbyte_zero" { - null = true - type = character(1) - } - column "nonbyte_one" { - null = true - type = character(1) - } - column "nonbyte_two" { - null = false - type = character(1) - } - column "nonbyte_three" { - null = true - type = character(1) - default = "a" - } - column "nonbyte_four" { - null = false - type = character(1) - default = "b" - } - column "nonbyte_five" { - null = true - type = character(1000) - } - column "nonbyte_six" { - null = true - type = character(1000) - } - column "nonbyte_seven" { - null = false - type = character(1000) - } - column "nonbyte_eight" { - null = true - type = character(1000) - default = "a" - } - column "nonbyte_nine" { - null = false - type = character(1000) - default = "b" - } - column "byte_zero" { - null = true - type = sql("\"char\"") - } - column "byte_one" { - null = true - type = sql("\"char\"") - } - column "byte_two" { - null = true - type = sql("\"char\"") - default = sql("'a'::\"char\"") - } - column "byte_three" { - null = false - type = sql("\"char\"") - } - column "byte_four" { - null = false - type = sql("\"char\"") - default = sql("'b'::\"char\"") - } - column "big_int_zero" { - null = true - type = bigint - } - column "big_int_one" { - null = true - type = bigint - } - column "big_int_two" { - null = false - type = bigint - } - column "big_int_three" { - null = true - type = bigint - default = 111111 - } - column "big_int_four" { - null = false - type = bigint - default = 222222 - } - column "big_int_five" { - null = true - type = bigint - default = 0 - } - column "big_int_six" { - null = false - type = bigint - default = 0 - } - column "int_zero" { - null = true - type = integer - } - column "int_one" { - null = true - type = integer - } - column "int_two" { - null = false - type = integer - } - column "int_three" { - null = true - type = integer - default = 333333 - } - column "int_four" { - null = false - type = integer - default = 444444 - } - column "int_five" { - null = true - type = integer - default = 0 - } - column "int_six" { - null = false - type = integer - default = 0 - } - column "float_zero" { - null = true - type = numeric - } - column "float_one" { - null = true - type = numeric - } - column "float_two" { - null = true - type = numeric(2,1) - } - column "float_three" { - null = true - type = numeric(2,1) - } - column "float_four" { - null = true - type = numeric(2,1) - } - column "float_five" { - null = false - type = numeric(2,1) - } - column "float_six" { - null = true - type = numeric(2,1) - default = 1.1 - } - column "float_seven" { - null = false - type = numeric(2,1) - default = 1.1 - } - column "float_eight" { - null = true - type = numeric(2,1) - default = 0 - } - column "float_nine" { - null = true - type = numeric(2,1) - default = 0 - } - column "bytea_zero" { - null = true - type = bytea - } - column "bytea_one" { - null = true - type = bytea - } - column "bytea_two" { - null = false - type = bytea - } - column "bytea_three" { - null = false - type = bytea - default = "\\x61" - } - column "bytea_four" { - null = true - type = bytea - default = "\\x62" - } - column "bytea_five" { - null = false - type = bytea - default = "\\x616263646566676861626364656667686162636465666768" - } - column "bytea_six" { - null = true - type = bytea - default = "\\x686766656463626168676665646362616867666564636261" - } - column "bytea_seven" { - null = false - type = bytea - default = "\\x" - } - column "bytea_eight" { - null = false - type = bytea - default = "\\x" - } - column "time_zero" { - null = true - type = timestamp - } - column "time_one" { - null = true - type = date - } - column "time_two" { - null = true - type = timestamp - } - column "time_three" { - null = true - type = timestamp - } - column "time_four" { - null = false - type = timestamp - } - column "time_five" { - null = true - type = timestamp - default = "1999-01-08 04:05:06.789" - } - column "time_six" { - null = true - type = timestamp - default = "1999-01-08 04:05:06.789" - } - column "time_seven" { - null = true - type = timestamp - default = "1999-01-08 04:05:06" - } - column "time_eight" { - null = false - type = timestamp - default = "1999-01-08 04:05:06.789" - } - column "time_nine" { - null = false - type = timestamp - default = "1999-01-08 04:05:06.789" - } - column "time_ten" { - null = false - type = timestamp - default = "1999-01-08 04:05:06" - } - column "time_eleven" { - null = true - type = date - } - column "time_twelve" { - null = false - type = date - } - column "time_thirteen" { - null = true - type = date - default = "1999-01-08" - } - column "time_fourteen" { - null = true - type = date - default = "1999-01-08" - } - column "time_fifteen" { - null = true - type = date - default = "1999-01-08" - } - column "time_sixteen" { - null = false - type = date - default = "1999-01-08" - } - column "time_seventeen" { - null = false - type = date - default = "1999-01-08" - } - column "time_eighteen" { - null = false - type = date - default = "1999-01-08" - } - column "uuid_zero" { - null = true - type = uuid - } - column "uuid_one" { - null = true - type = uuid - } - column "uuid_two" { - null = true - type = uuid - } - column "uuid_three" { - null = false - type = uuid - } - column "uuid_four" { - null = true - type = uuid - default = "6ba7b810-9dad-11d1-80b4-00c04fd430c8" - } - column "uuid_five" { - null = false - type = uuid - default = "6ba7b810-9dad-11d1-80b4-00c04fd430c8" - } - column "integer_default" { - null = true - type = integer - default = 5 - } - column "varchar_default" { - null = true - type = character_varying(1000) - default = sql("(5)::character varying") - } - column "timestamp_notz" { - null = true - type = timestamp - default = sql("(now() AT TIME ZONE 'utc'::text)") - } - column "timestamp_tz" { - null = true - type = timestamptz - default = sql("(now() AT TIME ZONE 'utc'::text)") - } - column "interval_nnull" { - null = false - type = interval - default = sql("'21 days'::interval") - } - column "interval_null" { - null = true - type = interval - default = sql("'23:00:00'::interval") - } - column "json_null" { - null = true - type = json - } - column "json_nnull" { - null = false - type = json - } - column "jsonb_null" { - null = true - type = jsonb - } - column "jsonb_nnull" { - null = false - type = jsonb - } - column "box_null" { - null = true - type = box - } - column "box_nnull" { - null = false - type = box - } - column "cidr_null" { - null = true - type = cidr - } - column "cidr_nnull" { - null = false - type = cidr - } - column "circle_null" { - null = true - type = circle - } - column "circle_nnull" { - null = false - type = circle - } - column "double_prec_null" { - null = true - type = double_precision - } - column "double_prec_nnull" { - null = false - type = double_precision - } - column "inet_null" { - null = true - type = inet - } - column "inet_nnull" { - null = false - type = inet - } - column "line_null" { - null = true - type = line - } - column "line_nnull" { - null = false - type = line - } - column "lseg_null" { - null = true - type = lseg - } - column "lseg_nnull" { - null = false - type = lseg - } - column "macaddr_null" { - null = true - type = macaddr - } - column "macaddr_nnull" { - null = false - type = macaddr - } - column "money_null" { - null = true - type = money - } - column "money_nnull" { - null = false - type = money - } - column "path_null" { - null = true - type = path - } - column "path_nnull" { - null = false - type = path - } - column "pg_lsn_null" { - null = true - type = sql("pg_lsn") - } - column "pg_lsn_nnull" { - null = false - type = sql("pg_lsn") - } - column "point_null" { - null = true - type = point - } - column "point_nnull" { - null = false - type = point - } - column "polygon_null" { - null = true - type = polygon - } - column "polygon_nnull" { - null = false - type = polygon - } - column "tsquery_null" { - null = true - type = tsquery - } - column "tsquery_nnull" { - null = false - type = tsquery - } - column "tsvector_null" { - null = true - type = tsvector - } - column "tsvector_nnull" { - null = false - type = tsvector - } - column "txid_null" { - null = true - type = sql("txid_snapshot") - } - column "txid_nnull" { - null = false - type = sql("txid_snapshot") - } - column "xml_null" { - null = true - type = xml - } - column "xml_nnull" { - null = false - type = xml - } - column "intarr_null" { - null = true - type = sql("integer[]") - } - column "intarr_nnull" { - null = false - type = sql("integer[]") - } - column "boolarr_null" { - null = true - type = sql("boolean[]") - } - column "boolarr_nnull" { - null = false - type = sql("boolean[]") - } - column "varchararr_null" { - null = true - type = sql("character varying[]") - } - column "varchararr_nnull" { - null = false - type = sql("character varying[]") - } - column "decimalarr_null" { - null = true - type = sql("numeric[]") - } - column "decimalarr_nnull" { - null = false - type = sql("numeric[]") - } - column "byteaarr_null" { - null = true - type = sql("bytea[]") - } - column "byteaarr_nnull" { - null = false - type = sql("bytea[]") - } - column "jsonbarr_null" { - null = true - type = sql("jsonb[]") - } - column "jsonbarr_nnull" { - null = false - type = sql("jsonb[]") - } - column "jsonarr_null" { - null = true - type = sql("json[]") - } - column "jsonarr_nnull" { - null = false - type = sql("json[]") - } - column "enumarr_null" { - null = true - type = sql("workday[]") - } - column "enumarr_nnull" { - null = false - type = sql("workday[]") - } - column "customarr_null" { - null = true - type = sql("my_int_array") - } - column "customarr_nnull" { - null = false - type = sql("my_int_array") - } - column "domainuint3_nnull" { - null = false - type = sql("uint3") - } - column "base" { - null = true - type = text - } - column "generated_nnull" { - null = false - type = text - as { - expr = "upper(base)" - type = STORED - } - } - column "generated_null" { - null = true - type = text - as { - expr = "upper(base)" - type = STORED - } - } - primary_key { - columns = [column.id] - } -} -table "users" { - schema = schema.public - column "id" { - null = false - type = serial - } - column "email_validated" { - null = true - type = boolean - default = false - comment = "Has the email address been tested?" - } - column "primary_email" { - null = true - type = character_varying(100) - comment = "The user's preferred email address.\n\nUse this to send emails to the user." - } - primary_key { - columns = [column.id] - } - index "users_primary_email_key" { - unique = true - columns = [column.primary_email] - } -} -table "video_tags" { - schema = schema.public - column "video_id" { - null = false - type = integer - } - column "tag_id" { - null = false - type = integer - } - primary_key { - columns = [column.video_id, column.tag_id] - } - foreign_key "video_tags_tag_id_fkey" { - columns = [column.tag_id] - ref_columns = [table.tags.column.id] - on_update = NO_ACTION - on_delete = NO_ACTION - } - foreign_key "video_tags_video_id_fkey" { - columns = [column.video_id] - ref_columns = [table.videos.column.id] - on_update = NO_ACTION - on_delete = NO_ACTION - } -} -table "videos" { - schema = schema.public - column "id" { - null = false - type = serial - comment = "The ID of the video" - } - column "user_id" { - null = false - type = integer - } - column "sponsor_id" { - null = true - type = integer - } - primary_key { - columns = [column.id] - } - foreign_key "videos_sponsor_id_fkey" { - columns = [column.sponsor_id] - ref_columns = [table.sponsors.column.id] - on_update = NO_ACTION - on_delete = NO_ACTION - } - foreign_key "videos_user_id_fkey" { - columns = [column.user_id] - ref_columns = [table.users.column.id] - on_update = NO_ACTION - on_delete = NO_ACTION - } - index "videos_sponsor_id_key" { - unique = true - columns = [column.sponsor_id] - } -} -enum "workday" { - schema = schema.public - values = ["monday", "tuesday", "wednesday", "thursday", "friday"] -} -domain "uint3" { - schema = schema.public - type = smallint - check "uint3_check" { - expr = "(VALUE >= 0 AND VALUE <= 7)" - } -} - -domain "my_int_array" { - schema = schema.public - type = sql("integer[]") -} -schema "public" { -} diff --git a/gen/bobgen-atlas/driver/test_schema/sqlite/schema.hcl b/gen/bobgen-atlas/driver/test_schema/sqlite/schema.hcl deleted file mode 100644 index c000c278..00000000 --- a/gen/bobgen-atlas/driver/test_schema/sqlite/schema.hcl +++ /dev/null @@ -1,666 +0,0 @@ -table "users" { - schema = schema.main - column "id" { - null = false - type = int - } - primary_key { - columns = [column.id] - } -} -table "sponsors" { - schema = schema.main - column "id" { - null = false - type = int - } - primary_key { - columns = [column.id] - } -} -table "videos" { - schema = schema.main - column "id" { - null = false - type = int - } - column "user_id" { - null = false - type = int - } - column "sponsor_id" { - null = true - type = int - } - primary_key { - columns = [column.id] - } - foreign_key "0" { - columns = [column.sponsor_id] - ref_columns = [table.sponsors.column.id] - on_update = NO_ACTION - on_delete = NO_ACTION - } - foreign_key "1" { - columns = [column.user_id] - ref_columns = [table.users.column.id] - on_update = NO_ACTION - on_delete = NO_ACTION - } - index "videos_sponsor_id" { - unique = true - columns = [column.sponsor_id] - } -} -table "tags" { - schema = schema.main - column "id" { - null = false - type = int - } - primary_key { - columns = [column.id] - } -} -table "video_tags" { - schema = schema.main - column "video_id" { - null = false - type = int - } - column "tag_id" { - null = false - type = int - } - primary_key { - columns = [column.video_id, column.tag_id] - } - foreign_key "0" { - columns = [column.tag_id] - ref_columns = [table.tags.column.id] - on_update = NO_ACTION - on_delete = NO_ACTION - } - foreign_key "1" { - columns = [column.video_id] - ref_columns = [table.videos.column.id] - on_update = NO_ACTION - on_delete = NO_ACTION - } -} -table "type_monsters" { - schema = schema.main - column "id" { - null = false - type = int - } - column "id_two" { - null = false - type = int - } - column "id_three" { - null = true - type = int - } - column "bool_zero" { - null = true - type = bool - } - column "bool_one" { - null = true - type = bool - } - column "bool_two" { - null = false - type = bool - } - column "bool_three" { - null = true - type = bool - default = false - } - column "bool_four" { - null = true - type = bool - default = true - } - column "bool_five" { - null = false - type = bool - default = false - } - column "bool_six" { - null = false - type = bool - default = true - } - column "string_zero" { - null = true - type = varchar(1) - } - column "string_one" { - null = true - type = varchar(1) - } - column "string_two" { - null = false - type = varchar(1) - } - column "string_three" { - null = true - type = varchar(1) - default = "a" - } - column "string_four" { - null = false - type = varchar(1) - default = "b" - } - column "string_five" { - null = true - type = varchar(1000) - } - column "string_six" { - null = true - type = varchar(1000) - } - column "string_seven" { - null = false - type = varchar(1000) - } - column "string_eight" { - null = true - type = varchar(1000) - default = "abcdefgh" - } - column "string_nine" { - null = false - type = varchar(1000) - default = "abcdefgh" - } - column "string_ten" { - null = true - type = varchar(1000) - default = "" - } - column "string_eleven" { - null = false - type = varchar(1000) - default = "" - } - column "big_int_zero" { - null = true - type = bigint - } - column "big_int_one" { - null = true - type = bigint - } - column "big_int_two" { - null = false - type = bigint - } - column "big_int_three" { - null = true - type = bigint - default = 111111 - } - column "big_int_four" { - null = false - type = bigint - default = 222222 - } - column "big_int_five" { - null = true - type = bigint - default = 0 - } - column "big_int_six" { - null = false - type = bigint - default = 0 - } - column "int_zero" { - null = true - type = int - } - column "int_one" { - null = true - type = int - } - column "int_two" { - null = false - type = int - } - column "int_three" { - null = true - type = int - default = 333333 - } - column "int_four" { - null = false - type = int - default = 444444 - } - column "int_five" { - null = true - type = int - default = 0 - } - column "int_six" { - null = false - type = int - default = 0 - } - column "float_zero" { - null = true - type = float - } - column "float_one" { - null = true - type = float - } - column "float_two" { - null = true - type = float - } - column "float_three" { - null = true - type = float - } - column "float_four" { - null = true - type = float - } - column "float_five" { - null = false - type = float - } - column "float_six" { - null = true - type = float - default = 1.1 - } - column "float_seven" { - null = false - type = float - default = 1.1 - } - column "float_eight" { - null = true - type = float - default = 0 - } - column "float_nine" { - null = true - type = float - default = 0 - } - column "bytea_zero" { - null = true - type = clob - } - column "bytea_one" { - null = true - type = clob - } - column "bytea_two" { - null = false - type = clob - } - column "bytea_three" { - null = false - type = clob - default = "a" - } - column "bytea_four" { - null = true - type = clob - default = "b" - } - column "bytea_five" { - null = false - type = clob - default = "abcdefghabcdefghabcdefgh" - } - column "bytea_six" { - null = true - type = clob - default = "hgfedcbahgfedcbahgfedcba" - } - column "bytea_seven" { - null = false - type = clob - default = "" - } - column "bytea_eight" { - null = false - type = clob - default = "" - } - column "time_zero" { - null = true - type = sql("timestamp") - } - column "time_one" { - null = true - type = date - } - column "time_two" { - null = true - type = sql("timestamp") - default = sql("null") - } - column "time_three" { - null = true - type = sql("timestamp") - } - column "time_five" { - null = true - type = sql("timestamp") - default = sql("current_timestamp") - } - column "time_nine" { - null = false - type = sql("timestamp") - default = sql("current_timestamp") - } - column "time_eleven" { - null = true - type = date - } - column "time_twelve" { - null = false - type = date - } - column "time_fifteen" { - null = true - type = date - default = "19990108" - } - column "time_sixteen" { - null = false - type = date - default = "1999-01-08" - } - column "json_null" { - null = true - type = json - } - column "json_nnull" { - null = false - type = json - } - column "tinyint_null" { - null = true - type = tinyint - } - column "tinyint_nnull" { - null = false - type = tinyint - } - column "tinyint1_null" { - null = true - type = tinyint - } - column "tinyint1_nnull" { - null = false - type = tinyint - } - column "tinyint2_null" { - null = true - type = tinyint - } - column "tinyint2_nnull" { - null = false - type = tinyint - } - column "smallint_null" { - null = true - type = smallint - } - column "smallint_nnull" { - null = false - type = smallint - } - column "mediumint_null" { - null = true - type = mediumint - } - column "mediumint_nnull" { - null = false - type = mediumint - } - column "bigint_null" { - null = true - type = bigint - } - column "bigint_nnull" { - null = false - type = bigint - } - column "float_null" { - null = true - type = float - } - column "float_nnull" { - null = false - type = float - } - column "double_null" { - null = true - type = double - } - column "double_nnull" { - null = false - type = double - } - column "doubleprec_null" { - null = true - type = double_precision - } - column "doubleprec_nnull" { - null = false - type = double_precision - } - column "real_null" { - null = true - type = real - } - column "real_nnull" { - null = false - type = real - } - column "boolean_null" { - null = true - type = boolean - } - column "boolean_nnull" { - null = false - type = boolean - } - column "date_null" { - null = true - type = date - } - column "date_nnull" { - null = false - type = date - } - column "datetime_null" { - null = true - type = datetime - } - column "datetime_nnull" { - null = false - type = datetime - } - column "timestamp_null" { - null = true - type = sql("timestamp") - } - column "timestamp_nnull" { - null = false - type = sql("timestamp") - default = sql("current_timestamp") - } - column "binary_null" { - null = true - type = clob - } - column "binary_nnull" { - null = false - type = clob - } - column "varbinary_null" { - null = true - type = clob - } - column "varbinary_nnull" { - null = false - type = clob - } - column "tinyblob_null" { - null = true - type = clob - } - column "tinyblob_nnull" { - null = false - type = clob - } - column "blob_null" { - null = true - type = blob - } - column "blob_nnull" { - null = false - type = blob - } - column "mediumblob_null" { - null = true - type = clob - } - column "mediumblob_nnull" { - null = false - type = clob - } - column "longblob_null" { - null = true - type = clob - } - column "longblob_nnull" { - null = false - type = clob - } - column "varchar_null" { - null = true - type = varchar(100) - } - column "varchar_nnull" { - null = false - type = varchar(100) - } - column "char_null" { - null = true - type = sql("char") - } - column "char_nnull" { - null = false - type = sql("char") - } - column "text_null" { - null = true - type = text - } - column "text_nnull" { - null = false - type = text - } - primary_key { - columns = [column.id] - } -} -table "autoinctest" { - schema = schema.main - column "id" { - type = integer - } - primary_key { - columns = [column.id] - } -} -table "autoinckeywordtest" { - schema = schema.main - column "id" { - type = integer - auto_increment = true - } - column "user_id" { - null = false - type = int - } - column "sponsor_id" { - null = true - type = int - } - column "something" { - null = true - type = text - } - column "another" { - null = true - type = text - } - primary_key { - columns = [column.id] - } - foreign_key "0" { - columns = [column.user_id, column.sponsor_id] - ref_columns = [table.videos.column.user_id, table.videos.column.sponsor_id] - on_update = NO_ACTION - on_delete = NO_ACTION - } - index "autoinckeywordtest_sponsor_id" { - unique = true - columns = [column.sponsor_id] - } - index "autoinckeywordtest_something_another" { - unique = true - columns = [column.something, column.another] - } -} -table "has_generated_columns" { - schema = schema.main - column "a" { - type = integer - } - column "b" { - null = true - type = int - } - column "c" { - null = true - type = text - } - column "d" { - null = true - type = int - as { - expr = "(a*abs(b))" - type = VIRTUAL - } - } - column "e" { - null = true - type = text - as { - expr = "(substr(c,b,b+1))" - type = STORED - } - } - primary_key { - columns = [column.a] - } -} -schema "main" { -} diff --git a/gen/bobgen-atlas/main.go b/gen/bobgen-atlas/main.go deleted file mode 100644 index 36907d8b..00000000 --- a/gen/bobgen-atlas/main.go +++ /dev/null @@ -1,72 +0,0 @@ -package main - -import ( - "context" - "io/fs" - "log" - "os" - "os/signal" - "syscall" - - "github.com/stephenafamo/bob/gen" - "github.com/stephenafamo/bob/gen/bobgen-atlas/driver" - helpers "github.com/stephenafamo/bob/gen/bobgen-helpers" - "github.com/urfave/cli/v2" -) - -func main() { - ctx, cancel := signal.NotifyContext( - context.Background(), - syscall.SIGINT, - syscall.SIGTERM, - ) - defer cancel() - - app := &cli.App{ - Name: "bobgen-atlas", - Usage: "Generate models and factories from your Atlas schema files", - UsageText: "bobgen-atlas [-c FILE]", - Version: helpers.Version(), - Flags: []cli.Flag{ - &cli.StringFlag{ - Name: "config", - Aliases: []string{"c"}, - Value: helpers.DefaultConfigPath, - Usage: "Load configuration from `FILE`", - }, - }, - Action: run, - } - - if err := app.RunContext(ctx, os.Args); err != nil { - log.Fatal(err) - } -} - -func run(c *cli.Context) error { - config, driverConfig, err := helpers.GetConfigFromFile[driver.Config](c.String("config"), "atlas") - if err != nil { - return err - } - - var modelTemplates []fs.FS - switch driverConfig.Dialect { - case "mysql": - modelTemplates = append(modelTemplates, gen.MySQLModelTemplates) - case "sqlite": - modelTemplates = append(modelTemplates, gen.SQLiteModelTemplates) - } - - d := driver.New(driverConfig, os.DirFS(driverConfig.Dir)) - outputs := helpers.DefaultOutputs( - driverConfig.Output, driverConfig.Pkgname, config.NoFactory, - &helpers.Templates{Models: modelTemplates}, - ) - - state := &gen.State{ - Config: config, - Outputs: outputs, - } - - return gen.Run(c.Context, state, d) -} diff --git a/gen/bobgen-prisma/driver/prisma.go b/gen/bobgen-prisma/driver/prisma.go deleted file mode 100644 index 87c5c919..00000000 --- a/gen/bobgen-prisma/driver/prisma.go +++ /dev/null @@ -1,374 +0,0 @@ -package driver - -import ( - "context" - "fmt" - "sort" - "strings" - - "github.com/iancoleman/strcase" - helpers "github.com/stephenafamo/bob/gen/bobgen-helpers" - "github.com/stephenafamo/bob/gen/drivers" - "github.com/takuoki/gocase" -) - -type ( - Interface = drivers.Interface[Extra] - DBInfo = drivers.DBInfo[Extra] - Provider struct { - DriverName string - DriverPkg string - DriverSource string - DriverENVSource string - } - Extra struct { - Provider Provider - } - Config struct { - // List of tables that will be included. Others are ignored - Only map[string][]string - // List of tables that will be should be ignored. Others are included - Except map[string][]string - - // The name you wish to assign to your generated models package - Pkgname string - NoFactory bool `yaml:"no_factory"` - } -) - -func New(config Config, dialect string, provider Provider, datamodel Datamodel) Interface { - if config.Pkgname == "" { - config.Pkgname = "prisma" - } - return &driver{ - dialect: dialect, - config: config, - provider: provider, - datamodel: datamodel, - types: helpers.Types(), - } -} - -// driver holds the database connection string and a handle -// to the database connection. -type driver struct { - dialect string - config Config - enums map[string]drivers.Enum - provider Provider - datamodel Datamodel - types drivers.Types -} - -func (d *driver) Dialect() string { - return d.dialect -} - -func (d *driver) PackageName() string { - return d.config.Pkgname -} - -func (d *driver) Capabilities() drivers.Capabilities { - return drivers.Capabilities{} -} - -func (d *driver) Types() drivers.Types { - return d.types -} - -// Assemble all the information we need to provide back to the driver -func (d *driver) Assemble(_ context.Context) (*DBInfo, error) { - var dbinfo *DBInfo - var err error - - // drivers.Tables call translateColumnType which uses Enums - d.loadEnums() - - dbinfo = &DBInfo{ - Tables: d.tables(), - ExtraInfo: Extra{ - Provider: d.provider, - }, - Enums: d.getEnums(), - } - - return dbinfo, err -} - -func (d *driver) tables() []drivers.Table { - models := d.datamodel.Models - tables := make([]drivers.Table, 0, len(models)) - - tblFilter := drivers.ParseTableFilter(d.config.Only, d.config.Except) - - colFilter := drivers.ParseColumnFilter(TableNamesFromFilter(models, drivers.Filter{ - Only: tblFilter.Only, - Except: tblFilter.Except, - }), d.config.Only, d.config.Except) - - for _, model := range models { - if drivers.Skip(model.TableName(), tblFilter.Only, tblFilter.Except) { - continue - } - - pk, uniques, fks := d.getKeys(model, colFilter) - - table := drivers.Table{ - Key: model.TableName(), - Name: model.TableName(), - Columns: d.tableColumns(model, colFilter), - Constraints: drivers.Constraints{ - Primary: pk, - Uniques: uniques, - Foreign: fks, - }, - } - tables = append(tables, table) - } - - return tables -} - -func TableNamesFromFilter(models []Model, tableFilter drivers.Filter) []string { - names := make([]string, 0, len(models)) - - for _, m := range models { - if drivers.Skip(m.TableName(), tableFilter.Only, tableFilter.Except) { - continue - } - - names = append(names, m.TableName()) - } - - return names -} - -func (p *driver) loadEnums() { - if p.enums != nil { - return - } - p.enums = map[string]drivers.Enum{} - - enums := p.datamodel.Enums - for _, enum := range enums { - values := make([]string, len(enum.Values)) - for i, val := range enum.Values { - values[i] = val.Name - } - - p.enums[enum.Name] = drivers.Enum{ - Type: gocase.To(strcase.ToCamel(enum.Name)), - Values: values, - } - } -} - -func (p *driver) getEnums() []drivers.Enum { - enums := make([]drivers.Enum, 0, len(p.enums)) - for _, e := range p.enums { - enums = append(enums, e) - } - - sort.Slice(enums, func(i, j int) bool { - return enums[i].Type < enums[j].Type - }) - - return enums -} - -func (d *driver) tableColumns(model Model, colFilter drivers.ColumnFilter) []drivers.Column { - allfilter := colFilter["*"] - filter := colFilter[model.TableName()] - include := append(allfilter.Only, filter.Only...) - exclude := append(allfilter.Except, filter.Except...) - - columns := make([]drivers.Column, 0, len(model.Fields)) - for _, field := range model.Fields { - if drivers.Skip(field.Name, include, exclude) { - continue - } - - if field.Kind == FieldKindObject { - continue - } - - column := drivers.Column{ - Name: field.Name, - DBType: field.Type, - Comment: field.Documentation, - Nullable: !field.IsRequired, - Generated: field.IsGenerated, - AutoIncr: field.Default.AutoIncr, - } - - if field.HasDefaultValue { - column.Default = "DEFAULT" - } - - // A generated column technically has a default value - if column.Generated && column.Default == "" { - column.Default = "GENERATED" - } - - // A nullable column can always default to NULL - if !field.IsRequired && column.Default == "" { - column.Default = "NULL" - } - - columns = append(columns, d.translateColumnType(column, field.IsList)) - } - - return columns -} - -func (d *driver) translateColumnType(c drivers.Column, isArray bool) drivers.Column { - switch isArray { - case false: // not an array - switch c.DBType { - case "String": - c.Type = "string" - case "Boolean": - c.Type = "bool" - case "Int": - c.Type = "int" - case "BigInt": - c.Type = "int64" - case "Float": - c.Type = "float64" - case "Bytes": - c.Type = "[]byte" - case "Decimal": - c.Type = "decimal.Decimal" - case "DateTime": - c.Type = "time.Time" - case "Json": - c.Type = "types.JSON[json.RawMessage]" - default: - if enum, ok := d.enums[c.DBType]; ok { - c.Type = helpers.EnumType(d.types, enum.Type) - } else { - c.Type = "string" - } - } - - case true: // Is an array - switch c.DBType { - case "String": - c.Type = "pq.StringArray" - case "Boolean": - c.Type = "pq.BoolArray" - case "Int", "BigInt": - c.Type = "pq.Int64Array" - case "Float": - c.Type = "pq.Float64Array" - case "Bytes": - c.Type = "pq.ByteaArray" - case "Decimal": - c.Type = helpers.AddPgGenericArrayType(d.types, "decimal.Decimal") - case "DateTime": - c.Type = helpers.AddPgGenericArrayType(d.types, "time.Time") - case "Json": - c.Type = helpers.AddPgGenericArrayType(d.types, "types.JSON[json.RawMessage]") - default: - if enum, ok := d.enums[c.DBType]; ok { - c.Type = helpers.AddPgEnumArrayType(d.types, enum.Type) - } else { - c.Type = "pq.StringArray" - } - } - c.DBType += "[]" - } - - return c -} - -func (d *driver) getKeys(model Model, colFilter drivers.ColumnFilter) (*drivers.PrimaryKey, []drivers.Constraint, []drivers.ForeignKey) { - var pk *drivers.PrimaryKey - var uniques []drivers.Constraint - var fks []drivers.ForeignKey - - tableName := model.TableName() - filter := colFilter[tableName] - only := filter.Only - except := filter.Except - - // If it is a composite primary key defined on the model - if len(model.PrimaryKey.Fields) > 0 { - shouldSkip := false - cols := make([]string, len(model.PrimaryKey.Fields)) - - for i, f := range model.PrimaryKey.Fields { - if drivers.Skip(f, only, except) { - shouldSkip = true - } - cols[i] = f - } - - if !shouldSkip { - pkName := model.PrimaryKey.Name - if pkName == "" { - pkName = "pk_" + tableName - } - pk = &drivers.Constraint{ - Name: pkName, - Columns: cols, - } - } - } - - for _, unique := range model.UniqueIndexes { - shouldSkip := false - cols := make([]string, len(unique.Fields)) - - for i, f := range unique.Fields { - if drivers.Skip(f, only, except) { - shouldSkip = true - } - cols[i] = f - } - - if !shouldSkip { - keyName := unique.InternalName - if keyName == "" { - keyName = fmt.Sprintf("unique_%s_%s", tableName, strings.Join(cols, "_")) - } - - uniques = append(uniques, drivers.Constraint{ - Name: keyName, - Columns: cols, - }) - } - } - - // If one of the fields has an @id attribute - for _, field := range model.Fields { - if drivers.Skip(field.Name, only, except) { - continue - } - - if field.IsID { - pk = &drivers.Constraint{ - Name: "pk_" + tableName, - Columns: []string{field.Name}, - } - } - - if field.IsUnique { - uniques = append(uniques, drivers.Constraint{ - Name: fmt.Sprintf("unique_%s_%s", tableName, field.Name), - Columns: []string{field.Name}, - }) - } - - if field.Kind == FieldKindObject && len(field.RelationFromFields) > 0 { - fks = append(fks, drivers.ForeignKey{ - Name: field.RelationName, - Columns: field.RelationFromFields, - ForeignTable: d.datamodel.ModelByName(field.Type).TableName(), - ForeignColumns: field.RelationToFields, - }) - } - } - - return pk, uniques, fks -} diff --git a/gen/bobgen-prisma/driver/prisma.mysql_golden.json b/gen/bobgen-prisma/driver/prisma.mysql_golden.json deleted file mode 100644 index c78adb28..00000000 --- a/gen/bobgen-prisma/driver/prisma.mysql_golden.json +++ /dev/null @@ -1,1741 +0,0 @@ -{ - "tables": [ - { - "key": "sponsors", - "schema": "", - "name": "sponsors", - "columns": [ - { - "name": "id", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int" - } - ], - "indexes": null, - "constraints": { - "primary": { - "name": "pk_sponsors", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "tags", - "schema": "", - "name": "tags", - "columns": [ - { - "name": "id", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int" - } - ], - "indexes": null, - "constraints": { - "primary": { - "name": "pk_tags", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "type_monsters", - "schema": "", - "name": "type_monsters", - "columns": [ - { - "name": "id", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int" - }, - { - "name": "enum_use", - "db_type": "workday", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "Workday" - }, - { - "name": "enum_nullable", - "db_type": "workday", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "Workday" - }, - { - "name": "bool_zero", - "db_type": "Boolean", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_one", - "db_type": "Boolean", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_two", - "db_type": "Boolean", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_three", - "db_type": "Boolean", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_four", - "db_type": "Boolean", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_five", - "db_type": "Boolean", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_six", - "db_type": "Boolean", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "string_zero", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_one", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_two", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_three", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_four", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_five", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_six", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_seven", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_eight", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_nine", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_ten", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_eleven", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_zero", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_one", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_two", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_three", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_four", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_five", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_six", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_seven", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_eight", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_nine", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "byte_zero", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "byte_one", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "byte_two", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "byte_three", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "byte_four", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "big_int_zero", - "db_type": "BigInt", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_one", - "db_type": "BigInt", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_two", - "db_type": "BigInt", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_three", - "db_type": "BigInt", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_four", - "db_type": "BigInt", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_five", - "db_type": "BigInt", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_six", - "db_type": "BigInt", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "int_zero", - "db_type": "Int", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "int_one", - "db_type": "Int", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "int_two", - "db_type": "Int", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "int_three", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "int_four", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "int_five", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "int_six", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "float_zero", - "db_type": "Decimal", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_one", - "db_type": "Decimal", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_two", - "db_type": "Decimal", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_three", - "db_type": "Decimal", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_four", - "db_type": "Decimal", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_five", - "db_type": "Decimal", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_six", - "db_type": "Decimal", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_seven", - "db_type": "Decimal", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_eight", - "db_type": "Decimal", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_nine", - "db_type": "Decimal", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "bytea_zero", - "db_type": "Bytes", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_one", - "db_type": "Bytes", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_two", - "db_type": "Bytes", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_three", - "db_type": "Bytes", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_four", - "db_type": "Bytes", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_five", - "db_type": "Bytes", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_six", - "db_type": "Bytes", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_seven", - "db_type": "Bytes", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_eight", - "db_type": "Bytes", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "time_zero", - "db_type": "DateTime", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_one", - "db_type": "DateTime", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_two", - "db_type": "DateTime", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_three", - "db_type": "DateTime", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_four", - "db_type": "DateTime", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_five", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_six", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_seven", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_eight", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_nine", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_ten", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_eleven", - "db_type": "DateTime", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_twelve", - "db_type": "DateTime", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_thirteen", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_fourteen", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_fifteen", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_sixteen", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_seventeen", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_eighteen", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "uuid_zero", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "uuid_one", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "uuid_two", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "uuid_three", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "uuid_four", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "uuid_five", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "integer_default", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "varchar_default", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "timestamp_notz", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "timestamp_tz", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "json_null", - "db_type": "Json", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "types.JSON[json.RawMessage]" - }, - { - "name": "json_nnull", - "db_type": "Json", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "types.JSON[json.RawMessage]" - }, - { - "name": "jsonb_null", - "db_type": "Json", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "types.JSON[json.RawMessage]" - }, - { - "name": "jsonb_nnull", - "db_type": "Json", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "types.JSON[json.RawMessage]" - }, - { - "name": "double_prec_null", - "db_type": "Float", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float64" - }, - { - "name": "double_prec_nnull", - "db_type": "Float", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float64" - }, - { - "name": "inet_null", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "inet_nnull", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "money_null", - "db_type": "Decimal", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "money_nnull", - "db_type": "Decimal", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "xml_null", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "xml_nnull", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "intarr_null", - "db_type": "Int[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.Int64Array" - }, - { - "name": "intarr_nnull", - "db_type": "Int[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.Int64Array" - }, - { - "name": "boolarr_null", - "db_type": "Boolean[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.BoolArray" - }, - { - "name": "boolarr_nnull", - "db_type": "Boolean[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.BoolArray" - }, - { - "name": "varchararr_null", - "db_type": "String[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.StringArray" - }, - { - "name": "varchararr_nnull", - "db_type": "String[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.StringArray" - }, - { - "name": "decimalarr_null", - "db_type": "Decimal[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[decimal.Decimal]" - }, - { - "name": "decimalarr_nnull", - "db_type": "Decimal[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[decimal.Decimal]" - }, - { - "name": "byteaarr_null", - "db_type": "Bytes[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.ByteaArray" - }, - { - "name": "byteaarr_nnull", - "db_type": "Bytes[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.ByteaArray" - }, - { - "name": "jsonbarr_null", - "db_type": "Json[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[types.JSON[json.RawMessage]]" - }, - { - "name": "jsonbarr_nnull", - "db_type": "Json[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[types.JSON[json.RawMessage]]" - }, - { - "name": "jsonarr_null", - "db_type": "Json[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[types.JSON[json.RawMessage]]" - }, - { - "name": "jsonarr_nnull", - "db_type": "Json[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[types.JSON[json.RawMessage]]" - }, - { - "name": "customarr_null", - "db_type": "Int[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.Int64Array" - }, - { - "name": "customarr_nnull", - "db_type": "Int[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.Int64Array" - }, - { - "name": "domainuint3_nnull", - "db_type": "Decimal", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "base", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "generated_nnull", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "generated_null", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - } - ], - "indexes": null, - "constraints": { - "primary": { - "name": "pk_type_monsters", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "users", - "schema": "", - "name": "users", - "columns": [ - { - "name": "id", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int" - }, - { - "name": "email_validated", - "db_type": "Boolean", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "primary_email", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - } - ], - "indexes": null, - "constraints": { - "primary": { - "name": "pk_users", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": [ - { - "name": "unique_users_primary_email", - "columns": [ - "primary_email" - ] - } - ] - } - }, - { - "key": "video_tags", - "schema": "", - "name": "video_tags", - "columns": [ - { - "name": "video_id", - "db_type": "Int", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "tag_id", - "db_type": "Int", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - } - ], - "indexes": null, - "constraints": { - "primary": { - "name": "pk_video_tags", - "columns": [ - "video_id", - "tag_id" - ] - }, - "foreign": [ - { - "name": "tagsTovideo_tags", - "columns": [ - "tag_id" - ], - "foreign_table": "tags", - "foreign_columns": [ - "id" - ] - }, - { - "name": "video_tagsTovideos", - "columns": [ - "video_id" - ], - "foreign_table": "videos", - "foreign_columns": [ - "id" - ] - } - ], - "uniques": null - } - }, - { - "key": "videos", - "schema": "", - "name": "videos", - "columns": [ - { - "name": "id", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int" - }, - { - "name": "user_id", - "db_type": "Int", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "sponsor_id", - "db_type": "Int", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - } - ], - "indexes": null, - "constraints": { - "primary": { - "name": "pk_videos", - "columns": [ - "id" - ] - }, - "foreign": [ - { - "name": "sponsorsTovideos", - "columns": [ - "sponsor_id" - ], - "foreign_table": "sponsors", - "foreign_columns": [ - "id" - ] - }, - { - "name": "usersTovideos", - "columns": [ - "user_id" - ], - "foreign_table": "users", - "foreign_columns": [ - "id" - ] - } - ], - "uniques": [ - { - "name": "unique_videos_sponsor_id", - "columns": [ - "sponsor_id" - ] - } - ] - } - } - ], - "enums": [ - { - "Type": "Workday", - "Values": [ - "monday", - "tuesday", - "wednesday", - "thursday", - "friday" - ] - } - ], - "extra_info": { - "Provider": { - "DriverName": "mysql", - "DriverPkg": "github.com/go-sql-driver/mysql", - "DriverSource": "", - "DriverENVSource": "" - } - }, - "driver_name": "" -} \ No newline at end of file diff --git a/gen/bobgen-prisma/driver/prisma.psql_golden.json b/gen/bobgen-prisma/driver/prisma.psql_golden.json deleted file mode 100644 index 4d6540c3..00000000 --- a/gen/bobgen-prisma/driver/prisma.psql_golden.json +++ /dev/null @@ -1,1741 +0,0 @@ -{ - "tables": [ - { - "key": "sponsors", - "schema": "", - "name": "sponsors", - "columns": [ - { - "name": "id", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int" - } - ], - "indexes": null, - "constraints": { - "primary": { - "name": "pk_sponsors", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "tags", - "schema": "", - "name": "tags", - "columns": [ - { - "name": "id", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int" - } - ], - "indexes": null, - "constraints": { - "primary": { - "name": "pk_tags", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "type_monsters", - "schema": "", - "name": "type_monsters", - "columns": [ - { - "name": "id", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int" - }, - { - "name": "enum_use", - "db_type": "workday", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "Workday" - }, - { - "name": "enum_nullable", - "db_type": "workday", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "Workday" - }, - { - "name": "bool_zero", - "db_type": "Boolean", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_one", - "db_type": "Boolean", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_two", - "db_type": "Boolean", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_three", - "db_type": "Boolean", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_four", - "db_type": "Boolean", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_five", - "db_type": "Boolean", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_six", - "db_type": "Boolean", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "string_zero", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_one", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_two", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_three", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_four", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_five", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_six", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_seven", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_eight", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_nine", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_ten", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_eleven", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_zero", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_one", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_two", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_three", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_four", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_five", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_six", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_seven", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_eight", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_nine", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "byte_zero", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "byte_one", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "byte_two", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "byte_three", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "byte_four", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "big_int_zero", - "db_type": "BigInt", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_one", - "db_type": "BigInt", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_two", - "db_type": "BigInt", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_three", - "db_type": "BigInt", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_four", - "db_type": "BigInt", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_five", - "db_type": "BigInt", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_six", - "db_type": "BigInt", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "int_zero", - "db_type": "Int", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "int_one", - "db_type": "Int", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "int_two", - "db_type": "Int", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "int_three", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "int_four", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "int_five", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "int_six", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "float_zero", - "db_type": "Decimal", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_one", - "db_type": "Decimal", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_two", - "db_type": "Decimal", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_three", - "db_type": "Decimal", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_four", - "db_type": "Decimal", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_five", - "db_type": "Decimal", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_six", - "db_type": "Decimal", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_seven", - "db_type": "Decimal", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_eight", - "db_type": "Decimal", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_nine", - "db_type": "Decimal", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "bytea_zero", - "db_type": "Bytes", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_one", - "db_type": "Bytes", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_two", - "db_type": "Bytes", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_three", - "db_type": "Bytes", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_four", - "db_type": "Bytes", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_five", - "db_type": "Bytes", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_six", - "db_type": "Bytes", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_seven", - "db_type": "Bytes", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_eight", - "db_type": "Bytes", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "time_zero", - "db_type": "DateTime", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_one", - "db_type": "DateTime", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_two", - "db_type": "DateTime", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_three", - "db_type": "DateTime", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_four", - "db_type": "DateTime", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_five", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_six", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_seven", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_eight", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_nine", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_ten", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_eleven", - "db_type": "DateTime", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_twelve", - "db_type": "DateTime", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_thirteen", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_fourteen", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_fifteen", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_sixteen", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_seventeen", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_eighteen", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "uuid_zero", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "uuid_one", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "uuid_two", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "uuid_three", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "uuid_four", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "uuid_five", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "integer_default", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "varchar_default", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "timestamp_notz", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "timestamp_tz", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "json_null", - "db_type": "Json", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "types.JSON[json.RawMessage]" - }, - { - "name": "json_nnull", - "db_type": "Json", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "types.JSON[json.RawMessage]" - }, - { - "name": "jsonb_null", - "db_type": "Json", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "types.JSON[json.RawMessage]" - }, - { - "name": "jsonb_nnull", - "db_type": "Json", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "types.JSON[json.RawMessage]" - }, - { - "name": "double_prec_null", - "db_type": "Float", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float64" - }, - { - "name": "double_prec_nnull", - "db_type": "Float", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float64" - }, - { - "name": "inet_null", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "inet_nnull", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "money_null", - "db_type": "Decimal", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "money_nnull", - "db_type": "Decimal", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "xml_null", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "xml_nnull", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "intarr_null", - "db_type": "Int[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.Int64Array" - }, - { - "name": "intarr_nnull", - "db_type": "Int[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.Int64Array" - }, - { - "name": "boolarr_null", - "db_type": "Boolean[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.BoolArray" - }, - { - "name": "boolarr_nnull", - "db_type": "Boolean[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.BoolArray" - }, - { - "name": "varchararr_null", - "db_type": "String[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.StringArray" - }, - { - "name": "varchararr_nnull", - "db_type": "String[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.StringArray" - }, - { - "name": "decimalarr_null", - "db_type": "Decimal[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[decimal.Decimal]" - }, - { - "name": "decimalarr_nnull", - "db_type": "Decimal[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[decimal.Decimal]" - }, - { - "name": "byteaarr_null", - "db_type": "Bytes[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.ByteaArray" - }, - { - "name": "byteaarr_nnull", - "db_type": "Bytes[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.ByteaArray" - }, - { - "name": "jsonbarr_null", - "db_type": "Json[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[types.JSON[json.RawMessage]]" - }, - { - "name": "jsonbarr_nnull", - "db_type": "Json[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[types.JSON[json.RawMessage]]" - }, - { - "name": "jsonarr_null", - "db_type": "Json[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[types.JSON[json.RawMessage]]" - }, - { - "name": "jsonarr_nnull", - "db_type": "Json[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[types.JSON[json.RawMessage]]" - }, - { - "name": "customarr_null", - "db_type": "Int[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.Int64Array" - }, - { - "name": "customarr_nnull", - "db_type": "Int[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.Int64Array" - }, - { - "name": "domainuint3_nnull", - "db_type": "Decimal", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "base", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "generated_nnull", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "generated_null", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - } - ], - "indexes": null, - "constraints": { - "primary": { - "name": "pk_type_monsters", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "users", - "schema": "", - "name": "users", - "columns": [ - { - "name": "id", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int" - }, - { - "name": "email_validated", - "db_type": "Boolean", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "primary_email", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - } - ], - "indexes": null, - "constraints": { - "primary": { - "name": "pk_users", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": [ - { - "name": "unique_users_primary_email", - "columns": [ - "primary_email" - ] - } - ] - } - }, - { - "key": "video_tags", - "schema": "", - "name": "video_tags", - "columns": [ - { - "name": "video_id", - "db_type": "Int", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "tag_id", - "db_type": "Int", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - } - ], - "indexes": null, - "constraints": { - "primary": { - "name": "pk_video_tags", - "columns": [ - "video_id", - "tag_id" - ] - }, - "foreign": [ - { - "name": "tagsTovideo_tags", - "columns": [ - "tag_id" - ], - "foreign_table": "tags", - "foreign_columns": [ - "id" - ] - }, - { - "name": "video_tagsTovideos", - "columns": [ - "video_id" - ], - "foreign_table": "videos", - "foreign_columns": [ - "id" - ] - } - ], - "uniques": null - } - }, - { - "key": "videos", - "schema": "", - "name": "videos", - "columns": [ - { - "name": "id", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int" - }, - { - "name": "user_id", - "db_type": "Int", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "sponsor_id", - "db_type": "Int", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - } - ], - "indexes": null, - "constraints": { - "primary": { - "name": "pk_videos", - "columns": [ - "id" - ] - }, - "foreign": [ - { - "name": "sponsorsTovideos", - "columns": [ - "sponsor_id" - ], - "foreign_table": "sponsors", - "foreign_columns": [ - "id" - ] - }, - { - "name": "usersTovideos", - "columns": [ - "user_id" - ], - "foreign_table": "users", - "foreign_columns": [ - "id" - ] - } - ], - "uniques": [ - { - "name": "unique_videos_sponsor_id", - "columns": [ - "sponsor_id" - ] - } - ] - } - } - ], - "enums": [ - { - "Type": "Workday", - "Values": [ - "monday", - "tuesday", - "wednesday", - "thursday", - "friday" - ] - } - ], - "extra_info": { - "Provider": { - "DriverName": "pgx", - "DriverPkg": "github.com/jackc/pgx/v5/stdlib", - "DriverSource": "", - "DriverENVSource": "" - } - }, - "driver_name": "" -} \ No newline at end of file diff --git a/gen/bobgen-prisma/driver/prisma.sqlite_golden.json b/gen/bobgen-prisma/driver/prisma.sqlite_golden.json deleted file mode 100644 index 136e0eed..00000000 --- a/gen/bobgen-prisma/driver/prisma.sqlite_golden.json +++ /dev/null @@ -1,1741 +0,0 @@ -{ - "tables": [ - { - "key": "sponsors", - "schema": "", - "name": "sponsors", - "columns": [ - { - "name": "id", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int" - } - ], - "indexes": null, - "constraints": { - "primary": { - "name": "pk_sponsors", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "tags", - "schema": "", - "name": "tags", - "columns": [ - { - "name": "id", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int" - } - ], - "indexes": null, - "constraints": { - "primary": { - "name": "pk_tags", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "type_monsters", - "schema": "", - "name": "type_monsters", - "columns": [ - { - "name": "id", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int" - }, - { - "name": "enum_use", - "db_type": "workday", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "Workday" - }, - { - "name": "enum_nullable", - "db_type": "workday", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "Workday" - }, - { - "name": "bool_zero", - "db_type": "Boolean", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_one", - "db_type": "Boolean", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_two", - "db_type": "Boolean", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_three", - "db_type": "Boolean", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_four", - "db_type": "Boolean", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_five", - "db_type": "Boolean", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "bool_six", - "db_type": "Boolean", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "string_zero", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_one", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_two", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_three", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_four", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_five", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_six", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_seven", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_eight", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_nine", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_ten", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "string_eleven", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_zero", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_one", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_two", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_three", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_four", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_five", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_six", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_seven", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_eight", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "nonbyte_nine", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "byte_zero", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "byte_one", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "byte_two", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "byte_three", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "byte_four", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "big_int_zero", - "db_type": "BigInt", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_one", - "db_type": "BigInt", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_two", - "db_type": "BigInt", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_three", - "db_type": "BigInt", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_four", - "db_type": "BigInt", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_five", - "db_type": "BigInt", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "big_int_six", - "db_type": "BigInt", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int64" - }, - { - "name": "int_zero", - "db_type": "Int", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "int_one", - "db_type": "Int", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "int_two", - "db_type": "Int", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "int_three", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "int_four", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "int_five", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "int_six", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "float_zero", - "db_type": "Decimal", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_one", - "db_type": "Decimal", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_two", - "db_type": "Decimal", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_three", - "db_type": "Decimal", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_four", - "db_type": "Decimal", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_five", - "db_type": "Decimal", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_six", - "db_type": "Decimal", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_seven", - "db_type": "Decimal", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_eight", - "db_type": "Decimal", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "float_nine", - "db_type": "Decimal", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "bytea_zero", - "db_type": "Bytes", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_one", - "db_type": "Bytes", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_two", - "db_type": "Bytes", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_three", - "db_type": "Bytes", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_four", - "db_type": "Bytes", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_five", - "db_type": "Bytes", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_six", - "db_type": "Bytes", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_seven", - "db_type": "Bytes", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "bytea_eight", - "db_type": "Bytes", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "[]byte" - }, - { - "name": "time_zero", - "db_type": "DateTime", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_one", - "db_type": "DateTime", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_two", - "db_type": "DateTime", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_three", - "db_type": "DateTime", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_four", - "db_type": "DateTime", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_five", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_six", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_seven", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_eight", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_nine", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_ten", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_eleven", - "db_type": "DateTime", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_twelve", - "db_type": "DateTime", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_thirteen", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_fourteen", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_fifteen", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_sixteen", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_seventeen", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "time_eighteen", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "uuid_zero", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "uuid_one", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "uuid_two", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "uuid_three", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "uuid_four", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "uuid_five", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "integer_default", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "varchar_default", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "timestamp_notz", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "timestamp_tz", - "db_type": "DateTime", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "time.Time" - }, - { - "name": "json_null", - "db_type": "Json", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "types.JSON[json.RawMessage]" - }, - { - "name": "json_nnull", - "db_type": "Json", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "types.JSON[json.RawMessage]" - }, - { - "name": "jsonb_null", - "db_type": "Json", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "types.JSON[json.RawMessage]" - }, - { - "name": "jsonb_nnull", - "db_type": "Json", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "types.JSON[json.RawMessage]" - }, - { - "name": "double_prec_null", - "db_type": "Float", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float64" - }, - { - "name": "double_prec_nnull", - "db_type": "Float", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "float64" - }, - { - "name": "inet_null", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "inet_nnull", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "money_null", - "db_type": "Decimal", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "money_nnull", - "db_type": "Decimal", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "xml_null", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "xml_nnull", - "db_type": "String", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "intarr_null", - "db_type": "Int[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.Int64Array" - }, - { - "name": "intarr_nnull", - "db_type": "Int[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.Int64Array" - }, - { - "name": "boolarr_null", - "db_type": "Boolean[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.BoolArray" - }, - { - "name": "boolarr_nnull", - "db_type": "Boolean[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.BoolArray" - }, - { - "name": "varchararr_null", - "db_type": "String[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.StringArray" - }, - { - "name": "varchararr_nnull", - "db_type": "String[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.StringArray" - }, - { - "name": "decimalarr_null", - "db_type": "Decimal[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[decimal.Decimal]" - }, - { - "name": "decimalarr_nnull", - "db_type": "Decimal[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[decimal.Decimal]" - }, - { - "name": "byteaarr_null", - "db_type": "Bytes[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.ByteaArray" - }, - { - "name": "byteaarr_nnull", - "db_type": "Bytes[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.ByteaArray" - }, - { - "name": "jsonbarr_null", - "db_type": "Json[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[types.JSON[json.RawMessage]]" - }, - { - "name": "jsonbarr_nnull", - "db_type": "Json[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[types.JSON[json.RawMessage]]" - }, - { - "name": "jsonarr_null", - "db_type": "Json[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[types.JSON[json.RawMessage]]" - }, - { - "name": "jsonarr_nnull", - "db_type": "Json[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pgtypes.Array[types.JSON[json.RawMessage]]" - }, - { - "name": "customarr_null", - "db_type": "Int[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.Int64Array" - }, - { - "name": "customarr_nnull", - "db_type": "Int[]", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "pq.Int64Array" - }, - { - "name": "domainuint3_nnull", - "db_type": "Decimal", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "decimal.Decimal" - }, - { - "name": "base", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "generated_nnull", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - }, - { - "name": "generated_null", - "db_type": "String", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - } - ], - "indexes": null, - "constraints": { - "primary": { - "name": "pk_type_monsters", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": null - } - }, - { - "key": "users", - "schema": "", - "name": "users", - "columns": [ - { - "name": "id", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int" - }, - { - "name": "email_validated", - "db_type": "Boolean", - "default": "DEFAULT", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "bool" - }, - { - "name": "primary_email", - "db_type": "String", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "string" - } - ], - "indexes": null, - "constraints": { - "primary": { - "name": "pk_users", - "columns": [ - "id" - ] - }, - "foreign": null, - "uniques": [ - { - "name": "unique_users_primary_email", - "columns": [ - "primary_email" - ] - } - ] - } - }, - { - "key": "video_tags", - "schema": "", - "name": "video_tags", - "columns": [ - { - "name": "video_id", - "db_type": "Int", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "tag_id", - "db_type": "Int", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - } - ], - "indexes": null, - "constraints": { - "primary": { - "name": "pk_video_tags", - "columns": [ - "video_id", - "tag_id" - ] - }, - "foreign": [ - { - "name": "tagsTovideo_tags", - "columns": [ - "tag_id" - ], - "foreign_table": "tags", - "foreign_columns": [ - "id" - ] - }, - { - "name": "video_tagsTovideos", - "columns": [ - "video_id" - ], - "foreign_table": "videos", - "foreign_columns": [ - "id" - ] - } - ], - "uniques": null - } - }, - { - "key": "videos", - "schema": "", - "name": "videos", - "columns": [ - { - "name": "id", - "db_type": "Int", - "default": "DEFAULT", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": true, - "domain_name": "", - "type": "int" - }, - { - "name": "user_id", - "db_type": "Int", - "default": "", - "comment": "", - "nullable": false, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - }, - { - "name": "sponsor_id", - "db_type": "Int", - "default": "NULL", - "comment": "", - "nullable": true, - "generated": false, - "autoincr": false, - "domain_name": "", - "type": "int" - } - ], - "indexes": null, - "constraints": { - "primary": { - "name": "pk_videos", - "columns": [ - "id" - ] - }, - "foreign": [ - { - "name": "sponsorsTovideos", - "columns": [ - "sponsor_id" - ], - "foreign_table": "sponsors", - "foreign_columns": [ - "id" - ] - }, - { - "name": "usersTovideos", - "columns": [ - "user_id" - ], - "foreign_table": "users", - "foreign_columns": [ - "id" - ] - } - ], - "uniques": [ - { - "name": "unique_videos_sponsor_id", - "columns": [ - "sponsor_id" - ] - } - ] - } - } - ], - "enums": [ - { - "Type": "Workday", - "Values": [ - "monday", - "tuesday", - "wednesday", - "thursday", - "friday" - ] - } - ], - "extra_info": { - "Provider": { - "DriverName": "sqlite", - "DriverPkg": "modernc.org/sqlite", - "DriverSource": "", - "DriverENVSource": "" - } - }, - "driver_name": "" -} \ No newline at end of file diff --git a/gen/bobgen-prisma/driver/prisma_test.go b/gen/bobgen-prisma/driver/prisma_test.go deleted file mode 100644 index b6ace533..00000000 --- a/gen/bobgen-prisma/driver/prisma_test.go +++ /dev/null @@ -1,103 +0,0 @@ -package driver - -import ( - _ "embed" - "encoding/json" - "flag" - "fmt" - "io/fs" - "os" - "testing" - - _ "github.com/jackc/pgx/v5/stdlib" - "github.com/stephenafamo/bob/gen" - helpers "github.com/stephenafamo/bob/gen/bobgen-helpers" - "github.com/stephenafamo/bob/gen/drivers" - testgen "github.com/stephenafamo/bob/test/gen" -) - -//go:embed test_data_model.json -var testDatamodel []byte - -var ( - dataModel Datamodel - flagOverwriteGolden = flag.Bool("overwrite-golden", false, "Overwrite the golden file with the current execution results") -) - -type testCase struct { - name string - provider Provider - goldenJson string - modelTemplates fs.FS -} - -func TestPostgres(t *testing.T) { - testDialect(t, testCase{ - name: "psql", - goldenJson: "prisma.psql_golden.json", - provider: Provider{ - DriverName: "pgx", - DriverPkg: "github.com/jackc/pgx/v5/stdlib", - }, - }) -} - -func TestMySQL(t *testing.T) { - testDialect(t, testCase{ - name: "mysql", - goldenJson: "prisma.mysql_golden.json", - provider: Provider{ - DriverName: "mysql", - DriverPkg: "github.com/go-sql-driver/mysql", - }, - modelTemplates: gen.MySQLModelTemplates, - }) -} - -func TestSQLite(t *testing.T) { - testDialect(t, testCase{ - name: "sqlite", - goldenJson: "prisma.sqlite_golden.json", - provider: Provider{ - DriverName: "sqlite", - DriverPkg: "modernc.org/sqlite", - }, - modelTemplates: gen.SQLiteModelTemplates, - }) -} - -func init() { - err := json.Unmarshal(testDatamodel, &dataModel) - if err != nil { - panic(fmt.Sprintf("could not decode test_data_model.json: %v", err)) - } -} - -func testDialect(t *testing.T, tt testCase) { - t.Helper() - out, err := os.MkdirTemp("", fmt.Sprintf("bobgen_prisma_%s_", tt.name)) - if err != nil { - t.Fatalf("unable to create tempdir: %s", err) - } - - // Defer cleanup of the tmp folder - defer func() { - if t.Failed() { - t.Log("template test output:", out) - return - } - os.RemoveAll(out) - }() - - testgen.TestDriver(t, testgen.DriverTestConfig[Extra]{ - Root: out, - GetDriver: func() drivers.Interface[Extra] { - return New(Config{}, tt.name, tt.provider, dataModel) - }, - GoldenFile: tt.goldenJson, - OverwriteGolden: *flagOverwriteGolden, - Templates: &helpers.Templates{ - Models: append([]fs.FS{gen.PrismaModelTemplates}, tt.modelTemplates), - }, - }) -} diff --git a/gen/bobgen-prisma/driver/test_data_model.json b/gen/bobgen-prisma/driver/test_data_model.json deleted file mode 100644 index cc794045..00000000 --- a/gen/bobgen-prisma/driver/test_data_model.json +++ /dev/null @@ -1,2250 +0,0 @@ -{ - "enums": [ - { - "name": "workday", - "values": [ - { - "name": "monday", - "dbName": null - }, - { - "name": "tuesday", - "dbName": null - }, - { - "name": "wednesday", - "dbName": null - }, - { - "name": "thursday", - "dbName": null - }, - { - "name": "friday", - "dbName": null - } - ], - "dbName": null - } - ], - "models": [ - { - "name": "User", - "dbName": "users", - "fields": [ - { - "name": "id", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": true, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Int", - "default": { - "name": "autoincrement", - "args": [] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "email_validated", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Boolean", - "default": false, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "primary_email", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": true, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "videos", - "kind": "object", - "isList": true, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "videos", - "relationName": "usersTovideos", - "relationFromFields": [], - "relationToFields": [], - "isGenerated": false, - "isUpdatedAt": false - } - ], - "primaryKey": null, - "uniqueFields": [], - "uniqueIndexes": [], - "isGenerated": false - }, - { - "name": "sponsors", - "dbName": null, - "fields": [ - { - "name": "id", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": true, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Int", - "default": { - "name": "autoincrement", - "args": [] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "videos", - "kind": "object", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "videos", - "relationName": "sponsorsTovideos", - "relationFromFields": [], - "relationToFields": [], - "isGenerated": false, - "isUpdatedAt": false - } - ], - "primaryKey": null, - "uniqueFields": [], - "uniqueIndexes": [], - "isGenerated": false - }, - { - "name": "tags", - "dbName": null, - "fields": [ - { - "name": "id", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": true, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Int", - "default": { - "name": "autoincrement", - "args": [] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "video_tags", - "kind": "object", - "isList": true, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "video_tags", - "relationName": "tagsTovideo_tags", - "relationFromFields": [], - "relationToFields": [], - "isGenerated": false, - "isUpdatedAt": false - } - ], - "primaryKey": null, - "uniqueFields": [], - "uniqueIndexes": [], - "isGenerated": false - }, - { - "name": "type_monsters", - "dbName": null, - "fields": [ - { - "name": "id", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": true, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Int", - "default": { - "name": "autoincrement", - "args": [] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "enum_use", - "kind": "enum", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "workday", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "enum_nullable", - "kind": "enum", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "workday", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "bool_zero", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Boolean", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "bool_one", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Boolean", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "bool_two", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Boolean", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "bool_three", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Boolean", - "default": false, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "bool_four", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Boolean", - "default": true, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "bool_five", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Boolean", - "default": false, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "bool_six", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Boolean", - "default": true, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "string_zero", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "string_one", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "string_two", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "string_three", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "String", - "default": "a", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "string_four", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "String", - "default": "b", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "string_five", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "string_six", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "string_seven", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "string_eight", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "String", - "default": "abcdefgh", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "string_nine", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "String", - "default": "abcdefgh", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "string_ten", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "String", - "default": "", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "string_eleven", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "String", - "default": "", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "nonbyte_zero", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "nonbyte_one", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "nonbyte_two", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "nonbyte_three", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "String", - "default": "a", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "nonbyte_four", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "String", - "default": "b", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "nonbyte_five", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "nonbyte_six", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "nonbyte_seven", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "nonbyte_eight", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "String", - "default": "a", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "nonbyte_nine", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "String", - "default": "b", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "byte_zero", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "byte_one", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "byte_two", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "String", - "default": "a", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "byte_three", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "byte_four", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "String", - "default": "b", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "big_int_zero", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "BigInt", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "big_int_one", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "BigInt", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "big_int_two", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "BigInt", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "big_int_three", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "BigInt", - "default": "111111", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "big_int_four", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "BigInt", - "default": "222222", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "big_int_five", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "BigInt", - "default": "0", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "big_int_six", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "BigInt", - "default": "0", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "int_zero", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Int", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "int_one", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Int", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "int_two", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Int", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "int_three", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Int", - "default": 333333, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "int_four", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Int", - "default": 444444, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "int_five", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Int", - "default": 0, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "int_six", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Int", - "default": 0, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "float_zero", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Decimal", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "float_one", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Decimal", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "float_two", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Decimal", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "float_three", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Decimal", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "float_four", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Decimal", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "float_five", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Decimal", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "float_six", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Decimal", - "default": 1.1, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "float_seven", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Decimal", - "default": 1.1, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "float_eight", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Decimal", - "default": 0, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "float_nine", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Decimal", - "default": 0, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "bytea_zero", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Bytes", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "bytea_one", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Bytes", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "bytea_two", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Bytes", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "bytea_three", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Bytes", - "default": "YQ==", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "bytea_four", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Bytes", - "default": "Yg==", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "bytea_five", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Bytes", - "default": "YWJjZGVmZ2hhYmNkZWZnaGFiY2RlZmdo", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "bytea_six", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Bytes", - "default": "aGdmZWRjYmFoZ2ZlZGNiYWhnZmVkY2Jh", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "bytea_seven", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Bytes", - "default": "", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "bytea_eight", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Bytes", - "default": "", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "time_zero", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "DateTime", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "time_one", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "DateTime", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "time_two", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "DateTime", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "time_three", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "DateTime", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "time_four", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "DateTime", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "time_five", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "DateTime", - "default": { - "name": "dbgenerated", - "args": [ - "'1999-01-08 04:05:06.789'::timestamp without time zone" - ] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "time_six", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "DateTime", - "default": { - "name": "dbgenerated", - "args": [ - "'1999-01-08 04:05:06.789'::timestamp without time zone" - ] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "time_seven", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "DateTime", - "default": { - "name": "dbgenerated", - "args": [ - "'1999-01-08 04:05:06'::timestamp without time zone" - ] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "time_eight", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "DateTime", - "default": { - "name": "dbgenerated", - "args": [ - "'1999-01-08 04:05:06.789'::timestamp without time zone" - ] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "time_nine", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "DateTime", - "default": { - "name": "dbgenerated", - "args": [ - "'1999-01-08 04:05:06.789'::timestamp without time zone" - ] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "time_ten", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "DateTime", - "default": { - "name": "dbgenerated", - "args": [ - "'1999-01-08 04:05:06'::timestamp without time zone" - ] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "time_eleven", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "DateTime", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "time_twelve", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "DateTime", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "time_thirteen", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "DateTime", - "default": { - "name": "dbgenerated", - "args": [ - "'1999-01-08'::date" - ] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "time_fourteen", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "DateTime", - "default": { - "name": "dbgenerated", - "args": [ - "'1999-01-08'::date" - ] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "time_fifteen", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "DateTime", - "default": { - "name": "dbgenerated", - "args": [ - "'1999-01-08'::date" - ] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "time_sixteen", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "DateTime", - "default": { - "name": "dbgenerated", - "args": [ - "'1999-01-08'::date" - ] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "time_seventeen", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "DateTime", - "default": { - "name": "dbgenerated", - "args": [ - "'1999-01-08'::date" - ] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "time_eighteen", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "DateTime", - "default": { - "name": "dbgenerated", - "args": [ - "'1999-01-08'::date" - ] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "uuid_zero", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "uuid_one", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "uuid_two", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "uuid_three", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "uuid_four", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "String", - "default": { - "name": "dbgenerated", - "args": [ - "'6ba7b810-9dad-11d1-80b4-00c04fd430c8'::uuid" - ] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "uuid_five", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "String", - "default": { - "name": "dbgenerated", - "args": [ - "'6ba7b810-9dad-11d1-80b4-00c04fd430c8'::uuid" - ] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "integer_default", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Int", - "default": 5, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "varchar_default", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "String", - "default": { - "name": "dbgenerated", - "args": [ - "(5)::character varying" - ] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "timestamp_notz", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "DateTime", - "default": { - "name": "dbgenerated", - "args": [ - "timezone('utc'::text, now())" - ] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "timestamp_tz", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "DateTime", - "default": { - "name": "dbgenerated", - "args": [ - "timezone('utc'::text, now())" - ] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "json_null", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Json", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "json_nnull", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Json", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "jsonb_null", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Json", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "jsonb_nnull", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Json", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "double_prec_null", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Float", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "double_prec_nnull", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Float", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "inet_null", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "inet_nnull", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "money_null", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Decimal", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "money_nnull", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Decimal", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "xml_null", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "xml_nnull", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "intarr_null", - "kind": "scalar", - "isList": true, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Int", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "intarr_nnull", - "kind": "scalar", - "isList": true, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Int", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "boolarr_null", - "kind": "scalar", - "isList": true, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Boolean", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "boolarr_nnull", - "kind": "scalar", - "isList": true, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Boolean", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "varchararr_null", - "kind": "scalar", - "isList": true, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "varchararr_nnull", - "kind": "scalar", - "isList": true, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "decimalarr_null", - "kind": "scalar", - "isList": true, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Decimal", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "decimalarr_nnull", - "kind": "scalar", - "isList": true, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Decimal", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "byteaarr_null", - "kind": "scalar", - "isList": true, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Bytes", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "byteaarr_nnull", - "kind": "scalar", - "isList": true, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Bytes", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "jsonbarr_null", - "kind": "scalar", - "isList": true, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Json", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "jsonbarr_nnull", - "kind": "scalar", - "isList": true, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Json", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "jsonarr_null", - "kind": "scalar", - "isList": true, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Json", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "jsonarr_nnull", - "kind": "scalar", - "isList": true, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Json", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "customarr_null", - "kind": "scalar", - "isList": true, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Int", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "customarr_nnull", - "kind": "scalar", - "isList": true, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Int", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "domainuint3_nnull", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "Decimal", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "base", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "String", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "generated_nnull", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "String", - "default": { - "name": "dbgenerated", - "args": [ - "upper(base)" - ] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "generated_null", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "String", - "default": { - "name": "dbgenerated", - "args": [ - "upper(base)" - ] - }, - "isGenerated": false, - "isUpdatedAt": false - } - ], - "primaryKey": null, - "uniqueFields": [], - "uniqueIndexes": [], - "isGenerated": false - }, - { - "name": "video_tags", - "dbName": null, - "fields": [ - { - "name": "video_id", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": true, - "hasDefaultValue": false, - "type": "Int", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "tag_id", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": true, - "hasDefaultValue": false, - "type": "Int", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "tags", - "kind": "object", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "tags", - "relationName": "tagsTovideo_tags", - "relationFromFields": [ - "tag_id" - ], - "relationToFields": [ - "id" - ], - "relationOnDelete": "NoAction", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "videos", - "kind": "object", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "videos", - "relationName": "video_tagsTovideos", - "relationFromFields": [ - "video_id" - ], - "relationToFields": [ - "id" - ], - "relationOnDelete": "NoAction", - "isGenerated": false, - "isUpdatedAt": false - } - ], - "primaryKey": { - "name": null, - "fields": [ - "video_id", - "tag_id" - ] - }, - "uniqueFields": [], - "uniqueIndexes": [], - "isGenerated": false - }, - { - "name": "videos", - "dbName": null, - "fields": [ - { - "name": "id", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": true, - "isReadOnly": false, - "hasDefaultValue": true, - "type": "Int", - "default": { - "name": "autoincrement", - "args": [] - }, - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "user_id", - "kind": "scalar", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": true, - "hasDefaultValue": false, - "type": "Int", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "sponsor_id", - "kind": "scalar", - "isList": false, - "isRequired": false, - "isUnique": true, - "isId": false, - "isReadOnly": true, - "hasDefaultValue": false, - "type": "Int", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "video_tags", - "kind": "object", - "isList": true, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "video_tags", - "relationName": "video_tagsTovideos", - "relationFromFields": [], - "relationToFields": [], - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "sponsors", - "kind": "object", - "isList": false, - "isRequired": false, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "sponsors", - "relationName": "sponsorsTovideos", - "relationFromFields": [ - "sponsor_id" - ], - "relationToFields": [ - "id" - ], - "relationOnDelete": "NoAction", - "isGenerated": false, - "isUpdatedAt": false - }, - { - "name": "users", - "kind": "object", - "isList": false, - "isRequired": true, - "isUnique": false, - "isId": false, - "isReadOnly": false, - "hasDefaultValue": false, - "type": "User", - "relationName": "usersTovideos", - "relationFromFields": [ - "user_id" - ], - "relationToFields": [ - "id" - ], - "relationOnDelete": "NoAction", - "isGenerated": false, - "isUpdatedAt": false - } - ], - "primaryKey": null, - "uniqueFields": [], - "uniqueIndexes": [], - "isGenerated": false - } - ], - "types": [] -} diff --git a/gen/bobgen-prisma/driver/types.go b/gen/bobgen-prisma/driver/types.go deleted file mode 100644 index fbaff6bd..00000000 --- a/gen/bobgen-prisma/driver/types.go +++ /dev/null @@ -1,116 +0,0 @@ -package driver - -import "encoding/json" - -// FieldKind describes a scalar, object or enum. -type FieldKind string - -// FieldKind values -const ( - FieldKindScalar FieldKind = "scalar" - FieldKindObject FieldKind = "object" - FieldKindEnum FieldKind = "enum" -) - -// Document describes the root of the AST. -type Document struct { - Datamodel Datamodel `json:"datamodel"` -} - -type Datamodel struct { - Models []Model `json:"models"` - Enums []struct { - Name string `json:"name"` - Values []EnumValue `json:"values"` - // DBName (optional) - DBName string `json:"dBName"` - } `json:"enums"` -} - -func (d Datamodel) ModelByName(name string) Model { - for _, m := range d.Models { - if name == m.Name { - return m - } - } - - return Model{} -} - -type PrimaryKey struct { - Name string `json:"name"` - Fields []string `json:"fields"` -} - -type UniqueIndex struct { - InternalName string `json:"name"` - Fields []string `json:"fields"` -} - -// Model describes a Prisma type model, which usually maps to a database table or collection. -type Model struct { - Name string `json:"name"` - IsEmbedded bool `json:"isEmbedded"` - DBName string `json:"dbName"` - Fields []Field `json:"fields"` - UniqueIndexes []UniqueIndex `json:"uniqueIndexes"` - PrimaryKey PrimaryKey `json:"primaryKey"` -} - -func (m Model) TableName() string { - if m.DBName != "" { - return m.DBName - } - - return m.Name -} - -// Field describes properties of a single model field. -type Field struct { - Kind FieldKind `json:"kind"` - Name string `json:"name"` - IsRequired bool `json:"isRequired"` - IsList bool `json:"isList"` - IsUnique bool `json:"isUnique"` - IsReadOnly bool `json:"isReadOnly"` - IsID bool `json:"isId"` - Type string `json:"type"` - // DBName (optional) - DBName string `json:"dBName"` - IsGenerated bool `json:"isGenerated"` - IsUpdatedAt bool `json:"isUpdatedAt"` - Documentation string `json:"documentation"` - // RelationFromFields (optional) - RelationFromFields []string `json:"relationFromFields"` - // RelationToFields (optional) - RelationToFields []string `json:"relationToFields"` - // RelationOnDelete (optional) - RelationOnDelete string `json:"relationOnDelete"` - // RelationName (optional) - RelationName string `json:"relationName"` - // HasDefaultValue - HasDefaultValue bool `json:"hasDefaultValue"` - Default fieldDefault `json:"default"` -} - -// EnumValue contains detailed information about an enum type. -type EnumValue struct { - Name string `json:"name"` - // DBName (optional) - DBName string `json:"dBName"` -} - -type fieldDefault struct { - AutoIncr bool -} - -// The Field default value from the dmmf can be any type since it -// depends on the type of the column -// We are only interested in auto increment values, so we ignore -// the error if the shape is not what we want -func (f *fieldDefault) UnmarshalJSON(data []byte) error { - var proxy struct{ Name string } - _ = json.Unmarshal(data, &proxy) // ignore error - f.AutoIncr = proxy.Name == "autoincrement" - return nil -} diff --git a/gen/bobgen-prisma/main.go b/gen/bobgen-prisma/main.go deleted file mode 100644 index 2f1f33ad..00000000 --- a/gen/bobgen-prisma/main.go +++ /dev/null @@ -1,326 +0,0 @@ -package main - -import ( - "bufio" - "bytes" - "context" - "encoding/json" - "errors" - "fmt" - "io" - "io/fs" - "log" - "os" - "os/exec" - "os/signal" - "path" - "syscall" - - "github.com/stephenafamo/bob/gen" - helpers "github.com/stephenafamo/bob/gen/bobgen-helpers" - "github.com/stephenafamo/bob/gen/bobgen-prisma/driver" -) - -//nolint:gochecknoglobals -var ( - writeDebugFile = os.Getenv("PRISMA_CLIENT_GO_WRITE_DMMF_FILE") != "" - prismaCLIPath = os.Getenv("PRISMA_CLI_PATH") -) - -func main() { - if os.Getenv("PRISMA_GENERATOR_INVOCATION") == "" { - // prisma CLI - if err := callPrisma(); err != nil { - panic(err) - } - - return - } - - // exit when signal triggers - c := make(chan os.Signal, 1) - signal.Notify(c, os.Interrupt, syscall.SIGTERM) - - go func() { - <-c - os.Exit(1) - }() - - if err := servePrisma(); err != nil { - log.Fatalf("error occurred when invoking prisma: %s", err) - } -} - -func reply(w io.Writer, data any) error { - b, err := json.Marshal(data) - if err != nil { - return fmt.Errorf("could not marshal data %w", err) - } - - b = append(b, byte('\n')) - - if _, err = w.Write(b); err != nil { - return fmt.Errorf("could not write data %w", err) - } - - return nil -} - -func servePrisma() error { - reader := bufio.NewReader(os.Stdin) - - if writeDebugFile { - dir, _ := os.Getwd() - log.Printf("current working dir: %s", dir) - } - - for { - content, err := reader.ReadBytes('\n') - if errors.Is(err, io.EOF) { - return nil - } - if err != nil { - return fmt.Errorf("could not read bytes from stdin: %w", err) - } - - if writeDebugFile { - buf := &bytes.Buffer{} - if err := json.Indent(buf, content, "", " "); err != nil { - log.Print(err) - } - if err := os.WriteFile("dmmf.json", buf.Bytes(), 0o600); err != nil { - log.Print(err) - } - } - - var input Request - - if err := json.Unmarshal(content, &input); err != nil { - return fmt.Errorf("could not open stdin %w", err) - } - - var response any - - switch input.Method { - case "getManifest": - response = ManifestResponse{ - Manifest: Manifest{ - DefaultOutput: path.Join(".", "db"), - PrettyName: "Bob Prisma Go Client", - }, - } - - case "generate": - response = nil // success - - var params root - - if err := json.Unmarshal(input.Params, ¶ms); err != nil { - dir, _ := os.Getwd() - return fmt.Errorf("could not unmarshal params into generator.Root type at %s: %w", dir, err) - } - - if err := generate(params); err != nil { - return fmt.Errorf("could not generate code. %w", err) - } - default: - return fmt.Errorf("no such method %s", input.Method) - } - - if err := reply(os.Stderr, NewResponse(input.ID, response)); err != nil { - return fmt.Errorf("could not reply %w", err) - } - } -} - -func generate(root root) error { - var err error - var dialect, driverName, driverPkg string - - modelTemplates := []fs.FS{gen.PrismaModelTemplates} - - datasource := root.Datasources[0] - switch datasource.Provider { - case ProviderPostgreSQL: - dialect = "psql" - driverName = "pgx" - driverPkg = "github.com/jackc/pgx/v5/stdlib" - case ProviderSQLite: - dialect = "sqlite" - driverName = "sqlite" - driverPkg = "modernc.org/sqlite" - modelTemplates = append(modelTemplates, gen.SQLiteModelTemplates) - case ProviderMySQL: - dialect = "mysql" - driverName = "mysql" - driverPkg = "github.com/go-sql-driver/mysql" - modelTemplates = append(modelTemplates, gen.MySQLModelTemplates) - default: - return fmt.Errorf("Unsupported datasource provider %q", datasource.Provider) - } - - configPath := root.Generator.Config.ConfigFile - if configPath == "" { - configPath = helpers.DefaultConfigPath - } - - config, driverConfig, err := helpers.GetConfigFromFile[driver.Config](configPath, "prisma") - if err != nil { - return err - } - - if driverConfig.Pkgname == "" { - driverConfig.Pkgname = "prisma" - } - - outputDir := root.Generator.Output.Value - if outputDir == "" { - return fmt.Errorf("no output folder configured") - } - - d := driver.New( - driverConfig, - dialect, - driver.Provider{ - DriverName: driverName, - DriverPkg: driverPkg, - DriverSource: datasource.URL.Value, - DriverENVSource: datasource.URL.FromEnvVar, - }, - root.DMMF.Datamodel, - ) - - outputs := helpers.DefaultOutputs( - outputDir, driverConfig.Pkgname, config.NoFactory, - &helpers.Templates{Models: modelTemplates}, - ) - - state := &gen.State{ - Config: config, - Outputs: outputs, - } - - relAliasPlugin := relAliasPlugin{ - models: root.DMMF.Datamodel.Models, - aliases: config.Aliases, - config: driverConfig, - } - - if err := gen.Run(context.Background(), state, d, relAliasPlugin); err != nil { - fmt.Println(err) // makes the error print better - return err - } - - return nil -} - -// Root describes the generator output root. -// overwritten so I can set the config -type root struct { - Generator Generator `json:"generator"` - Datasources []Datasource `json:"datasources"` - DMMF driver.Document `json:"DMMF"` - SchemaPath string `json:"schemaPath"` -} - -type config struct { - ConfigFile string `json:"configFile"` -} - -// callPrisma the prisma CLI with given arguments -func callPrisma() error { - if prismaCLIPath == "" { - prismaCLIPath = "prisma" - } - - cmd := exec.Command(prismaCLIPath, "generate") - cmd.Env = os.Environ() - cmd.Env = append(cmd.Env, "PRISMA_HIDE_UPDATE_MESSAGE=true") - - cmd.Stdin = os.Stdin - cmd.Stderr = os.Stderr - cmd.Stdout = os.Stdout - - if err := cmd.Run(); err != nil { - return fmt.Errorf("could not run %q: %w", "generate", err) - } - - return nil -} - -// Request sets a generic JSONRPC request, which wraps information and params. -type Request struct { - // JSONRPC describes the version of the JSON RPC protocol. Defaults to `2.0`. - JSONRPC string `json:"jsonrpc"` - // ID identifies a unique request. - ID int `json:"id"` - // Method describes the intention of the request. - Method string `json:"method"` - // Params contains the payload of the request. Usually parsed into a specific struct for further processing. - Params json.RawMessage `json:"params"` -} - -// Response sets a generic JSONRPC response, which wraps information and a result. -type Response struct { - // JSONRPC describes the version of the JSON RPC protocol. Defaults to `2.0`. - JSONRPC string `json:"jsonrpc"` - // ID identifies a unique request. - ID int `json:"id"` - // Result contains the payload of the response. - Result any `json:"result"` -} - -// NewResponse forms a new JSON RPC response to reply to the Prisma CLI commands -func NewResponse(id int, result any) Response { - return Response{ - JSONRPC: "2.0", - ID: id, - Result: result, - } -} - -// Manifest describes information for the Prisma Client Go generator for the Prisma CLI. -type Manifest struct { - PrettyName string `json:"prettyName"` - DefaultOutput string `json:"defaultOutput"` - Denylist []string `json:"denylist"` - RequiresGenerators []string `json:"requiresGenerators"` - RequiresEngines []string `json:"requiresEngines"` -} - -// ManifestResponse sets the response Prisma Client Go returns when Prisma asks for the Manifest. -type ManifestResponse struct { - Manifest Manifest `json:"manifest"` -} - -type Generator struct { - Name string `json:"name"` - Output Value `json:"output"` - Provider Value `json:"provider"` - Config config `json:"config"` -} - -// Datasource describes a Prisma data source of any database type. -type Datasource struct { - Name string `json:"name"` - Provider Provider `json:"provider"` - URL Value `json:"url"` -} - -type Value struct { - FromEnvVar string `json:"fromEnvVar"` - Value string `json:"value"` -} - -// Provider describes the Database of this generator. -type Provider string - -// Provider values -const ( - ProviderMySQL Provider = "mysql" - ProviderMongo Provider = "mongo" - ProviderSQLite Provider = "sqlite" - ProviderSQLServer Provider = "sqlserver" - ProviderPostgreSQL Provider = "postgresql" - ProviderCockroachDB Provider = "cockroachdb" -) diff --git a/gen/bobgen-prisma/plugin.go b/gen/bobgen-prisma/plugin.go deleted file mode 100644 index f5c8a560..00000000 --- a/gen/bobgen-prisma/plugin.go +++ /dev/null @@ -1,76 +0,0 @@ -package main - -import ( - "github.com/iancoleman/strcase" - "github.com/stephenafamo/bob/gen" - "github.com/stephenafamo/bob/gen/bobgen-prisma/driver" - "github.com/stephenafamo/bob/gen/drivers" -) - -// This plugin sets the default Alias of relationships based on the field name -// we do this after building the relationships based on the keys -type relAliasPlugin struct { - models []driver.Model - aliases gen.Aliases - config driver.Config -} - -func (p relAliasPlugin) Name() string { - return "relationshipAliaser" -} - -//nolint:unparam -func (p relAliasPlugin) PlugTemplateData(data *gen.TemplateData[driver.Extra]) error { - tblFilter := drivers.ParseTableFilter(p.config.Only, p.config.Except) - - colFilter := drivers.ParseColumnFilter( - driver.TableNamesFromFilter(p.models, drivers.Filter{ - Only: tblFilter.Only, - Except: tblFilter.Except, - }), p.config.Only, p.config.Except) - - for _, model := range p.models { - if drivers.Skip(model.TableName(), tblFilter.Only, tblFilter.Except) { - continue - } - - var table drivers.Table - for _, t := range data.Tables { - if t.Key == model.TableName() { - table = t - break - } - } - - if table.Key == "" { - continue - } - - tableName := model.TableName() - allfilter := colFilter["*"] - filter := colFilter[tableName] - include := append(allfilter.Only, filter.Only...) - exclude := append(allfilter.Except, filter.Except...) - for _, field := range model.Fields { - if drivers.Skip(field.Name, include, exclude) { - continue - } - - if field.Kind != driver.FieldKindObject { - continue - } - - for _, rel := range data.Relationships[table.Key] { - if rel.Name != field.RelationName { - continue - } - - if p.aliases[table.Key].Relationships[rel.Name] == "" { - data.Aliases[table.Key].Relationships[rel.Name] = strcase.ToCamel(field.Name) - } - } - } - } - - return nil -} diff --git a/gen/bobgen-prisma/templates/models/singleton/bob_prisma_client.go.tpl b/gen/bobgen-prisma/templates/models/singleton/bob_prisma_client.go.tpl deleted file mode 100644 index 6f1cda99..00000000 --- a/gen/bobgen-prisma/templates/models/singleton/bob_prisma_client.go.tpl +++ /dev/null @@ -1,14 +0,0 @@ -{{$.Importer.Import "github.com/stephenafamo/bob"}} -{{$.Importer.Import "_" $.ExtraInfo.Provider.DriverPkg}} -{{if $.ExtraInfo.Provider.DriverENVSource}}{{$.Importer.Import "os"}}{{end}} - -type DB = bob.DB - -func New() (DB, error) { - {{if $.ExtraInfo.Provider.DriverENVSource -}} - return bob.Open("{{$.ExtraInfo.Provider.DriverName}}", os.Getenv("{{$.ExtraInfo.Provider.DriverENVSource}}")) - {{- else -}} - return bob.Open("{{$.ExtraInfo.Provider.DriverName}}", "{{$.ExtraInfo.Provider.DriverSource}}") - {{- end}} -} - diff --git a/gen/templates.go b/gen/templates.go index 9c15ec0a..1a5df72d 100644 --- a/gen/templates.go +++ b/gen/templates.go @@ -23,9 +23,6 @@ var templates embed.FS //go:embed bobgen-mysql/templates var mysqlTemplates embed.FS -//go:embed bobgen-prisma/templates -var prismaTemplates embed.FS - //go:embed bobgen-psql/templates var psqlTemplates embed.FS @@ -37,7 +34,6 @@ var ( ModelTemplates, _ = fs.Sub(templates, "templates/models") FactoryTemplates, _ = fs.Sub(templates, "templates/factory") MySQLModelTemplates, _ = fs.Sub(mysqlTemplates, "bobgen-mysql/templates/models") - PrismaModelTemplates, _ = fs.Sub(prismaTemplates, "bobgen-prisma/templates/models") PSQLModelTemplates, _ = fs.Sub(psqlTemplates, "bobgen-psql/templates/models") SQLiteModelTemplates, _ = fs.Sub(sqliteTemplates, "bobgen-sqlite/templates/models") typesReplacer = strings.NewReplacer( diff --git a/go.mod b/go.mod index 87f04283..e2144ac0 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,6 @@ go 1.22 toolchain go1.22.1 require ( - ariga.io/atlas v0.9.0 github.com/DATA-DOG/go-txdb v0.1.6 github.com/Masterminds/sprig/v3 v3.2.2 github.com/aarondl/opt v0.0.0-20230114172057-b91f370c41f0 @@ -13,8 +12,6 @@ require ( github.com/fergusstrange/embedded-postgres v1.26.0 github.com/go-sql-driver/mysql v1.7.2-0.20231213112541-0004702b931d github.com/google/go-cmp v0.6.0 - github.com/hashicorp/hcl/v2 v2.10.0 - github.com/iancoleman/strcase v0.2.0 github.com/jackc/pgx/v5 v5.5.5 github.com/knadh/koanf/parsers/yaml v0.1.0 github.com/knadh/koanf/providers/confmap v0.1.0 @@ -26,7 +23,6 @@ require ( github.com/qdm12/reprint v0.0.0-20200326205758-722754a53494 github.com/stephenafamo/scan v0.6.0 github.com/stephenafamo/sqlparser v0.0.0-20241111104950-b04fa8a26c9c - github.com/takuoki/gocase v1.0.0 github.com/urfave/cli/v2 v2.23.7 github.com/volatiletech/strmangle v0.0.6 github.com/wasilibs/go-pgquery v0.0.0-20240319230125-b9b2e95c69a7 @@ -42,12 +38,9 @@ require ( github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/semver/v3 v3.1.1 // indirect github.com/aarondl/json v0.0.0-20221020222930-8b0db17ef1bf // indirect - github.com/agext/levenshtein v1.2.1 // indirect - github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect - github.com/go-openapi/inflect v0.19.0 // indirect github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 // indirect github.com/google/uuid v1.6.0 // indirect github.com/huandu/xstrings v1.3.1 // indirect @@ -60,13 +53,11 @@ require ( github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-sqlite3 v1.14.16 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect - github.com/mitchellh/go-wordwrap v1.0.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect github.com/ncruces/go-strftime v0.1.9 // indirect github.com/pganalyze/pg_query_go/v5 v5.1.0 // indirect github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/sergi/go-diff v1.1.0 // indirect github.com/shopspring/decimal v1.3.1 // indirect github.com/spf13/cast v1.5.0 // indirect github.com/stretchr/testify v1.8.2 // indirect @@ -74,7 +65,6 @@ require ( github.com/volatiletech/inflect v0.0.1 // indirect github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect - github.com/zclconf/go-cty v1.8.0 // indirect golang.org/x/crypto v0.17.0 // indirect golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect golang.org/x/sync v0.7.0 // indirect diff --git a/go.sum b/go.sum index 86abcb9f..1febf51b 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,5 @@ -ariga.io/atlas v0.9.0 h1:q0JMtqyA3X1YWtPcn+E/kVPwLDslb+jAC8Ejl/vW6d0= -ariga.io/atlas v0.9.0/go.mod h1:T230JFcENj4ZZzMkZrXFDSkv+2kXkUgpJ5FQQ5hMcKU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= -github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= -github.com/DATA-DOG/go-sqlmock v1.5.0/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/DATA-DOG/go-txdb v0.1.6 h1:D1Ob/L79mCW6UCFL6vwM/9TWs/rshZujxTsvy7+gicw= github.com/DATA-DOG/go-txdb v0.1.6/go.mod h1:DhAhxMXZpUJVGnT+p9IbzJoRKvlArO2pkHjnGX7o0n0= github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= @@ -16,14 +12,8 @@ github.com/aarondl/json v0.0.0-20221020222930-8b0db17ef1bf h1:+edM69bH/X6JpYPmJY github.com/aarondl/json v0.0.0-20221020222930-8b0db17ef1bf/go.mod h1:FZqLhJSj2tg0ZN48GB1zvj00+ZYcHPqgsC7yzcgCq6k= github.com/aarondl/opt v0.0.0-20230114172057-b91f370c41f0 h1:vLrhbOWVPxtHao/QthU8pcpI4DbtSGnWgH7qIJf8F6k= github.com/aarondl/opt v0.0.0-20230114172057-b91f370c41f0/go.mod h1:l4/5NZtYd/SIohsFhaJQQe+sPOTG22furpZ5FvcYOzk= -github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8= -github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ= github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= -github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= -github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= -github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= -github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -39,19 +29,11 @@ github.com/friendsofgo/errors v0.9.2 h1:X6NYxef4efCBdwI7BgS820zFaN7Cphrmb+Pljdzj github.com/friendsofgo/errors v0.9.2/go.mod h1:yCvFW5AkDIL9qn7suHVLiI/gH228n7PC4Pn44IGoTOI= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= -github.com/go-openapi/inflect v0.19.0 h1:9jCH9scKIbHeV9m12SmPilScz6krDxKRasNNSNPXu/4= -github.com/go-openapi/inflect v0.19.0/go.mod h1:lHpZVlpIQqLyKwJ4N+YSc9hchQy/i12fJykb83CRBH4= github.com/go-sql-driver/mysql v1.7.2-0.20231213112541-0004702b931d h1:QQP1nE4qh5aHTGvI1LgOFxZYVxYoGeMfbNHikogPyoA= github.com/go-sql-driver/mysql v1.7.2-0.20231213112541-0004702b931d/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg= -github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= -github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1 h1:TQcrn6Wq+sKGkpyPvppOz99zsMBaUOKXq6HSv655U1c= github.com/go-viper/mapstructure/v2 v2.0.0-alpha.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= @@ -60,12 +42,8 @@ github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S3 github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/hashicorp/hcl/v2 v2.10.0 h1:1S1UnuhDGlv3gRFV4+0EdwB+znNP5HmcGbIqwnSCByg= -github.com/hashicorp/hcl/v2 v2.10.0/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg= github.com/huandu/xstrings v1.3.1 h1:4jgBlKK6tLKFvO8u5pmYjG91cqytmDCDvGh7ECVFfFs= github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= -github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0= -github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= @@ -91,15 +69,10 @@ github.com/knadh/koanf/providers/file v0.1.0 h1:fs6U7nrV58d3CFAFh8VTde8TM262ObYf github.com/knadh/koanf/providers/file v0.1.0/go.mod h1:rjJ/nHQl64iYCtAW2QQnF0eSmDEX/YZ/eNFj5yR6BvA= github.com/knadh/koanf/v2 v2.1.0 h1:eh4QmHHBuU8BybfIJ8mB8K8gsGCD/AUQTdwGq/GzId8= github.com/knadh/koanf/v2 v2.1.0/go.mod h1:4mnTRbZCK+ALuBXHZMjDfG9y714L7TykVnZkXbMU3Es= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4= -github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= @@ -109,9 +82,6 @@ github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= -github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/mitchellh/go-wordwrap v1.0.0 h1:6GlHJ/LTGMrIJbwgdqdl2eEH8o+Exx/0m8ir9Gns0u4= -github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= @@ -131,16 +101,12 @@ github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjR github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= -github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= -github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stephenafamo/fakedb v0.0.0-20221230081958-0b86f816ed97 h1:XItoZNmhOih06TC02jK7l3wlpZ0XT/sPQYutDcGOQjg= github.com/stephenafamo/fakedb v0.0.0-20221230081958-0b86f816ed97/go.mod h1:bM3Vmw1IakoaXocHmMIGgJFYob0vuK+CFWiJHQvz0jQ= github.com/stephenafamo/scan v0.6.0 h1:N0joyP/wriC9VvP6w9SDxHIuQGatW4c2YW7Z5L4m45s= @@ -159,15 +125,10 @@ github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/takuoki/gocase v1.0.0 h1:gPwLJTWVm2T1kUiCsKirg/faaIUGVTI0FA3SYr75a44= -github.com/takuoki/gocase v1.0.0/go.mod h1:QgOKJrbuJoDrtoKswBX1/Dw8mJrkOV9tbQZJaxaJ6zc= github.com/tetratelabs/wazero v1.7.0 h1:jg5qPydno59wqjpGrHph81lbtHzTrWzwwtD4cD88+hQ= github.com/tetratelabs/wazero v1.7.0/go.mod h1:ytl6Zuh20R/eROuyDaGPkp82O9C/DJfXAwJfQ3X6/7Y= github.com/urfave/cli/v2 v2.23.7 h1:YHDQ46s3VghFHFf1DdF+Sh7H4RqhcM+t0TmZRJx4oJY= github.com/urfave/cli/v2 v2.23.7/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc= -github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= -github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= -github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= github.com/volatiletech/inflect v0.0.1 h1:2a6FcMQyhmPZcLa+uet3VJ8gLn/9svWhJxJYwvE8KsU= github.com/volatiletech/inflect v0.0.1/go.mod h1:IBti31tG6phkHitLlr5j7shC5SOo//x0AjDzaJU1PLA= github.com/volatiletech/strmangle v0.0.6 h1:AdOYE3B2ygRDq4rXDij/MMwq6KVK/pWAYxpC7CLrkKQ= @@ -178,14 +139,9 @@ github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 h1:nIPpBwaJSVYIxUFsDv3M8ofm github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8/go.mod h1:HUYIGzjTL3rfEspMxjDjgmT5uz5wzYJKVo23qUhYTos= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU= github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8= -github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= -github.com/zclconf/go-cty v1.8.0 h1:s4AvqaeQzJIu3ndv4gVIhplVD0krU+bgrcLSVUnaWuA= -github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= -github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200414173820-0848c9571904/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k= golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4= @@ -193,44 +149,31 @@ golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJ golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.21.0 h1:qc0xYgIbsSDt9EyWz05J5wfa7LOVW0YTLOXrqdLAWIw= golang.org/x/tools v0.21.0/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/website/docs/README.md b/website/docs/README.md index c00714ce..bb2af376 100644 --- a/website/docs/README.md +++ b/website/docs/README.md @@ -1,7 +1,5 @@ --- - sidebar_position: 1 - --- import DocCardList from '@theme/DocCardList'; @@ -11,13 +9,10 @@ import DocCardList from '@theme/DocCardList'; ## Support | | Queries | Models | ORM Gen | Factory Gen | -|---------------|---------|--------|---------|-------------| +| ------------- | ------- | ------ | ------- | ----------- | | Postgres | ✅ | ✅ | ✅ | ✅ | | MySQL/MariaDB | ✅ | ✅ | ✅ | ✅ | | SQLite | ✅ | ✅ | ✅ | ✅ | -| Atlas | | | ✅ | ✅ | -| Prisma | | | ✅ | ✅ | - Bob is a set of Go packages and tools to work with SQL databases. @@ -45,17 +40,17 @@ Bob includes an SQL executor that conveniently returns types from queries to avo Bob's executor can build and execute Bob queries in a single call. -* `One()`: To scan a single row -* `All()`: To scan all rows -* `Cursor()`: To loop through rows. Useful for large results -* `Prepare()`: For prepared statements +- `One()`: To scan a single row +- `All()`: To scan all rows +- `Cursor()`: To loop through rows. Useful for large results +- `Prepare()`: For prepared statements In addition, the executor covers the usual range of DB activities: -* Ping the database for health checks -* Start and run transactions -* Commit/Rollback -* Prepare and reuse statements +- Ping the database for health checks +- Start and run transactions +- Commit/Rollback +- Prepare and reuse statements To learn more, see the [sql executor documentation](./sql-executor/intro). @@ -95,39 +90,39 @@ To learn more about the methods attached to views and tables, see the [models do **Bob** includes code generators that will read your database structure and generate a fully featured and type safe ORM for you. -* Work with existing databases. Don't be the tool to define the schema, that's better left to other tools. -* Eliminate all sql boilerplate, have relationships as a first-class concept. -* Work with normal structs, call functions, no hyper-magical struct tags, small interfaces. -* The models package is type safe. This means no chance of random panics due to passing in the wrong type. No need for `interface{}`. -* The generated types closely correlate to your database column types. -* IDE auto-completion due to generated types and functions. -* Clean code that is easy to read and debug. +- Work with existing databases. Don't be the tool to define the schema, that's better left to other tools. +- Eliminate all sql boilerplate, have relationships as a first-class concept. +- Work with normal structs, call functions, no hyper-magical struct tags, small interfaces. +- The models package is type safe. This means no chance of random panics due to passing in the wrong type. No need for `interface{}`. +- The generated types closely correlate to your database column types. +- IDE auto-completion due to generated types and functions. +- Clean code that is easy to read and debug. ### Model Generation Types are generated for your database tables to use [Bob's models](./models/intro), in **addition** to that, the following are also generated: -* Additional convenience methods on the model structs for CRUD. -* A dedicated type for collections. -* Type safe variables for table and column names. -* Type safe representation of ENUMS. -* Query mods used for loading and querying relationships. - * Relationships are automatically detected by foreign keys. - * Relationships can also be manually defined. -* Convenient methods for querying a collection of models. +- Additional convenience methods on the model structs for CRUD. +- A dedicated type for collections. +- Type safe variables for table and column names. +- Type safe representation of ENUMS. +- Query mods used for loading and querying relationships. + - Relationships are automatically detected by foreign keys. + - Relationships can also be manually defined. +- Convenient methods for querying a collection of models. Some other features not found in many other Go ORMs. -* Fine-tuned control over relationship loading. - * Related-Through: Define relationships that cut across multiple tables - * Related-When: Define relations based on static values (e.g. `WHEN email_confirmed = true`) - * Loading relationships with left-joins - * Loading with additional queries - * Recursive relationship loading - * Select **EXACTLY** what columns you want to load. -* Support for cross-schema relationships -* Support for multi-column foreign key relationships -* Support for database views +- Fine-tuned control over relationship loading. + - Related-Through: Define relationships that cut across multiple tables + - Related-When: Define relations based on static values (e.g. `WHEN email_confirmed = true`) + - Loading relationships with left-joins + - Loading with additional queries + - Recursive relationship loading + - Select **EXACTLY** what columns you want to load. +- Support for cross-schema relationships +- Support for multi-column foreign key relationships +- Support for database views ### Factory Generator @@ -143,38 +138,38 @@ Without dedicated tools for this, we end up never properly testing our data laye Inspired by Ruby's factoryBot, **Bob** uses its knowledge of your database schema to generate factories that offer many benefits: -* Set base rules for how new objects are created, defaults are preset for required columns. -* Create templates from the rules, overriding specific columns as needed. -* Build models based on the model templates and use them in tests. -* Insert the model in the database to truly test your application. Bob will help you by inserting any dependent models. +- Set base rules for how new objects are created, defaults are preset for required columns. +- Create templates from the rules, overriding specific columns as needed. +- Build models based on the model templates and use them in tests. +- Insert the model in the database to truly test your application. Bob will help you by inserting any dependent models. diff --git a/website/docs/code-generation/atlas.md b/website/docs/code-generation/atlas.md deleted file mode 100644 index b971df40..00000000 --- a/website/docs/code-generation/atlas.md +++ /dev/null @@ -1,65 +0,0 @@ ---- -sidebar_position: 20 -title: Atlas Driver -description: ORM Generation for Atlas ---- - -# Bob Gen for Atlas - -Generates an ORM based on Atlas HCL schema files - -## Usage - -```sh -# With env variable -ATLAS_DIALECT=psql go run github.com/stephenafamo/bob/gen/bobgen-atlas@latest - -# With configuration file -go run github.com/stephenafamo/bob/gen/bobgen-atlas@latest -c ./config/bobgen.yaml -``` - -### Driver Configuration - -#### [Link to general configuration and usage](./configuration) - -The configuration for the atlas driver must be prefixed by the driver name. You must use a configuration file or environment variables for configuring the database driver. - -In the configuration file for atlas for example you would do: - -```yaml -atlas: - dialect: psql -``` - -When you use an environment variable it must also be prefixed by the driver name: - -```sh -ATLAS_DIALECT=psql -``` - -The values that exist for the drivers: - -| Name | Description | Default | -|---------------|-------------------------------------------|--------------------| -| dialect | Database dialect to use (REQUIRED) | | -| dir | Path to directory containing schema files | . | -| shared_schema | Schema to not include prefix in model | first schema found | -| output | Folder for generated files | "models" | -| pkgname | Package name for generated code | "models" | -| only | Only generate these | | -| except | Skip generation for these | | - -Example of Only/Except: - -```yaml -atlas: - # Removes public.migrations table, the name column from the addresses table, and - # secret_col of any table from being generated. Foreign keys that reference tables - # or columns that are no longer generated may cause problems. - except: - public.migrations: - public.addresses: - - name - "*": - - secret_col -``` diff --git a/website/docs/code-generation/intro.md b/website/docs/code-generation/intro.md index 6fc37f97..4497189e 100644 --- a/website/docs/code-generation/intro.md +++ b/website/docs/code-generation/intro.md @@ -10,18 +10,14 @@ import {useCurrentSidebarCategory} from '@docusaurus/theme-common'; Bob is a "database-first" ORM. That means you must first create your database schema. Please use something like [sql-migrate](https://github.com/rubenv/sql-migrate) or some other migration tool to manage this part of the database's life-cycle. -There is also a generator for other schema definitions like [Atlas' schema](https://atlasgo.io/atlas-schema/sql-resources) and [Prisma's schema](https://www.prisma.io/docs/concepts/components/prisma-schema). - ## Available Drivers | Sources | Driver | -|------------|------------------| +| ---------- | ---------------- | | PostgreSQL | [LINK](./psql) | | MySQL | [LINK](./mysql) | | SQLite | [LINK](./sqlite) | | SQL files | [LINK](./sql) | -| Atlas | [LINK](./atlas) | -| Prisma | [LINK](./prisma) | ## Features diff --git a/website/docs/code-generation/prisma.md b/website/docs/code-generation/prisma.md deleted file mode 100644 index 9bdac449..00000000 --- a/website/docs/code-generation/prisma.md +++ /dev/null @@ -1,171 +0,0 @@ ---- -sidebar_position: 21 -title: Prisma Driver -description: ORM Generation for Prisma ---- - -# Bob Gen for Prisma - -Generates an ORM based on a prisma schema file - -## How to Generate - -1. Initialise a new Go project. The generator must be run from inside a go module, so either the current directory or a parent directory should contain a `go.mod` file. If you don't have a Go project yet, initialise one using Go modules: - - ```shell script - mkdir demo && cd demo - go mod init demo - ``` - -2. Get the Bob Prisma Generator. Install the Go module in your project by running: - - ```shell script - go get github.com/stephenafamo/bob/gen/bobgen-prisma - ``` - -3. Prepare your database schema in a `schema.prisma` file. For example, a simple schema with a postgres database and the Bob Prisma generator with two models would look like this: - - ```prisma - datasource db { - // only postgresql is supported for now - provider = "postgresql" - url = env("DATABASE_URL") - } - - generator db { - provider = "go run github.com/stephenafamo/bob/gen/bobgen-prisma" - output = "./prisma" // Optional. Default: ./db - configFile = "./config/bobgen.yml" // Optional. Default ./bobgen.yaml - } - - model Post { - id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid - created_at DateTime @default(now()) @db.Timestamptz(6) - updated_at DateTime @db.Timestamptz(6) - title String - published Boolean - desc String? - } - ``` - -4. Generate the models using `prisma generate` - -## How to Use - -[Detailed documentation on how to use the Bob ORM can be found here](./intro) - -A small taste - -```go -package main - -import ( - "context" - "encoding/json" - "fmt" - - "random/prisma" - - "github.com/aarondl/opt/omit" - "github.com/aarondl/opt/omitnull" -) - -func main() { - if err := run(context.Background()); err != nil { - panic(err) - } -} - -func run(ctx context.Context) error { - client, err := prisma.New() - if err != nil { - return err - } - defer client.Close() - - // create a post - createdPost, err := prisma.PostsTable.Insert(ctx, client, &prisma.OptionalPost{ - Title: omit.From("Hi from Prisma!"), - Published: omit.From(true), - Desc: omitnull.From("Prisma is a database toolkit and makes databases easy."), - UpdatedAt: omit.From(time.Now()), - }) - if err != nil { - return err - } - - result, _ := json.MarshalIndent(createdPost, "", " ") - fmt.Printf("created post: %s\n", result) - - // find a single post - post, err := prisma.FindPost(ctx, client, createdPost.ID) - if err != nil { - return err - } - - result, _ = json.MarshalIndent(post, "", " ") - fmt.Printf("post: %s\n", result) - - // For optional/nullable values, the field will have a generic null wrapper - // with some helpful methods - if post.Desc.IsNull() { - return fmt.Errorf("post's description is null") - } - - fmt.Printf("The posts's description is: %s\n", post.Desc.MustGet()) - - return nil -} -``` - -[Detailed documentation on how to use the Bob ORM can be found here](./intro) - -## Driver Configuration - -### [Link to general configuration and usage](./configuration) - -The configuration for the prisma driver must all be prefixed by the driver name. You must use a configuration file or environment variables for configuring the database driver. - -In the configuration file for prisma for example you would do: - -```yaml -prisma: - schema: "public" -``` - -When you use an environment variable it must also be prefixed by the driver name: - -```sh -PRISMA_SCHEMA="public" -``` - -The values that exist for the drivers: - -| Name | Description | Default | -|---------|---------------------------------|----------| -| pkgname | Package name for generated code | "prisma" | -| only | Only generate these | | -| except | Skip generation for these | | - -Example of Only/Except: - -```yaml -psql: - # Removes Coupon model, the name field of the Product model, and - # secret of all Models from being generated. Foreign keys that reference tables - # or columns that are no longer generated may cause problems. - except: - User: - Product: - - name - "*": - - secret -``` - -[How to use](..) - -## Known Issues - -### `@map` attributes on columns are ignored - -This is because `@map` information is currently not given to generators by the `prisma` command. [See Issues #3998](https://github.com/prisma/prisma/issues/3998) diff --git a/website/docusaurus.config.js b/website/docusaurus.config.js index e0ad2aa5..11ceb71f 100644 --- a/website/docusaurus.config.js +++ b/website/docusaurus.config.js @@ -110,14 +110,6 @@ const config = { label: "SQL Files", to: "docs/code-generation/sql", }, - { - label: "Atlas", - to: "docs/code-generation/atlas", - }, - { - label: "Prisma", - to: "docs/code-generation/prisma", - }, ], }, {