Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

cannnot find exist tab,e #165

Open
Jinrgan opened this issue May 25, 2021 · 2 comments
Open

cannnot find exist tab,e #165

Jinrgan opened this issue May 25, 2021 · 2 comments

Comments

@Jinrgan
Copy link

Jinrgan commented May 25, 2021

gen --sqltype=mssql \

  --connstr "sqlserver://sa:Developer1234@localhost:1433?database=QLS_CXData" \
  --database QLS_CXData \
  --exclude ReportingPoint  \
  --gorm

Warning - LoadMeta skipping table info for Field error: mssql: Invalid object name 'QLS_CXData.Field'.
Warning - LoadMeta skipping table info for MetricsDataSet error: mssql: Invalid object name 'QLS_CXData.MetricsDataSet'.
Skipping excluded table ReportingPoint
No tables loaded

@dgoradia
Copy link

dgoradia commented May 27, 2021

I got this on the latest version v0.9.29 but it works for me on v0.9.27. I had to clone the repo, checkout v0.9.27 and then build it locally for it to work. (Also connecting to mssql as well)

@Jinrgan
Copy link
Author

Jinrgan commented May 30, 2021

OK, thanks a lot. I tried this on v0.9.27, but it comes a small problem:

table: Field unable to generate struct field: ItemId type: UNIQUEIDENTIFIER error: unknown sql type: uniqueidentifier
Generating code for the following tables (1)

and it didn't seem to generate the element ItemId in this struct. Maybe this uniqueidentifier type can be converted to []byte type in go?

create table Field
(
    FieldId          int identity
        constraint Field_PK
            primary key,
    ReportingPointId int                        not null
        constraint Field_FK_ReportingPointId
            references ReportingPoint,
    ItemId           uniqueidentifier           not null,
    ItemFullName     nvarchar(450)              not null,
    Name             nvarchar(128)              not null,
    PreviousName     nvarchar(128),
    ColumnName       nvarchar(32),
    DataType         nvarchar(32)               not null,
    IsFilterable     bit                        not null,
    IsIndexed        bit
        constraint Field_DF_IsIndexed default 0 not null
)
type Field struct {
	//[ 0] FieldId                                        INT                  null: false  primary: true   isArray: false  auto: true   col: INT             len: -1      default: []
	FieldID int32 `gorm:"primary_key;AUTO_INCREMENT;column:FieldId;type:INT;"`
	//[ 1] ReportingPointId                               INT                  null: false  primary: false  isArray: false  auto: false  col: INT             len: -1      default: []
	ReportingPointID int32 `gorm:"column:ReportingPointId;type:INT;"`
	//[ 3] ItemFullName                                   NVARCHAR(900)        null: false  primary: false  isArray: false  auto: false  col: NVARCHAR        len: 900     default: []
	ItemFullName string `gorm:"column:ItemFullName;type:NVARCHAR;size:900;"`
	//[ 4] Name                                           NVARCHAR(256)        null: false  primary: false  isArray: false  auto: false  col: NVARCHAR        len: 256     default: []
	Name string `gorm:"column:Name;type:NVARCHAR;size:256;"`
	//[ 5] PreviousName                                   NVARCHAR(256)        null: true   primary: false  isArray: false  auto: false  col: NVARCHAR        len: 256     default: []
	PreviousName sql.NullString `gorm:"column:PreviousName;type:NVARCHAR;size:256;"`
	//[ 6] ColumnName                                     NVARCHAR(64)         null: true   primary: false  isArray: false  auto: false  col: NVARCHAR        len: 64      default: []
	ColumnName sql.NullString `gorm:"column:ColumnName;type:NVARCHAR;size:64;"`
	//[ 7] DataType                                       NVARCHAR(64)         null: false  primary: false  isArray: false  auto: false  col: NVARCHAR        len: 64      default: []
	DataType string `gorm:"column:DataType;type:NVARCHAR;size:64;"`
	//[ 8] IsFilterable                                   BIT                  null: false  primary: false  isArray: false  auto: false  col: BIT             len: -1      default: []
	IsFilterable bool `gorm:"column:IsFilterable;type:BIT;"`
	//[ 9] IsIndexed                                      BIT                  null: false  primary: false  isArray: false  auto: false  col: BIT             len: -1      default: [0]
	IsIndexed bool `gorm:"column:IsIndexed;type:BIT;default:0;"`
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants