Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for createTable (0.22 sec)

  1. migrator.go

    	// AutoMigrate
    	AutoMigrate(dst ...interface{}) error
    
    	// Database
    	CurrentDatabase() string
    	FullDataTypeOf(*schema.Field) clause.Expr
    	GetTypeAliases(databaseTypeName string) []string
    
    	// Tables
    	CreateTable(dst ...interface{}) error
    	DropTable(dst ...interface{}) error
    	HasTable(dst interface{}) bool
    	RenameTable(oldName, newName interface{}) error
    	GetTables() (tableList []string, err error)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 3.1K bytes
    - Viewed (0)
  2. migrator/migrator.go

    	err = m.DB.Raw("SELECT TABLE_NAME FROM information_schema.tables where TABLE_SCHEMA=?", m.CurrentDatabase()).
    		Scan(&tableList).Error
    	return
    }
    
    // CreateTable create table in database for values
    func (m Migrator) CreateTable(values ...interface{}) error {
    	for _, value := range m.ReorderModels(values, false) {
    		tx := m.DB.Session(&gorm.Session{})
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  3. tests/postgres_test.go

    		t.Skip()
    	}
    
    	type Thing struct {
    		gorm.Model
    		SomeID  string
    		OtherID string
    		Data    string
    	}
    
    	DB.Migrator().DropTable(&Thing{})
    	DB.Migrator().CreateTable(&Thing{})
    	if err := DB.Exec("ALTER TABLE things ADD CONSTRAINT some_id_other_id_unique UNIQUE (some_id, other_id)").Error; err != nil {
    		t.Error(err)
    	}
    
    	thing := Thing{
    		SomeID:  "1234",
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Oct 08 09:16:32 GMT 2022
    - 6.4K bytes
    - Viewed (3)
  4. tests/migrate_test.go

    	for _, m := range allModels {
    		if !DB.Migrator().HasTable(m) {
    			t.Fatalf("Failed to create table for %#v", m)
    		}
    	}
    
    	DB.Scopes(func(db *gorm.DB) *gorm.DB {
    		return db.Table("ccc")
    	}).Migrator().CreateTable(&Company{})
    
    	if !DB.Migrator().HasTable("ccc") {
    		t.Errorf("failed to create table ccc")
    	}
    
    	for _, indexes := range [][2]string{
    		{"user_speaks", "fk_user_speaks_user"},
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  5. schema/schema_helper_test.go

    		}
    
    		if !ok {
    			t.Errorf("schema %v failed to look up field with name %v", s, f.Name)
    		} else {
    			tests.AssertObjEqual(t, parsedField, f, "Name", "DBName", "BindNames", "DataType", "PrimaryKey", "AutoIncrement", "Creatable", "Updatable", "Readable", "HasDefaultValue", "DefaultValue", "NotNull", "Unique", "Comment", "Size", "Precision", "TagSettings")
    
    			if f.DBName != "" {
    				if field, ok := s.FieldsByDBName[f.DBName]; !ok || parsedField != field {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 7.5K bytes
    - Viewed (0)
  6. schema/schema_test.go

    					Tag: `gorm:"primarykey"`, Creatable: true, Updatable: true, Readable: true, PrimaryKey: true, Size: 64,
    				},
    				{
    					Name: "LanguageCode", DBName: "language_code", BindNames: []string{"LanguageCode"}, DataType: schema.String,
    					Tag: `gorm:"primarykey"`, Creatable: true, Updatable: true, Readable: true, PrimaryKey: true,
    				},
    			}},
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Dec 15 08:31:23 GMT 2023
    - 12.9K bytes
    - Viewed (0)
  7. statement.go

    	}
    
    	if stmt.Schema != nil {
    		for _, field := range stmt.Schema.FieldsByName {
    			name := field.DBName
    			if name == "" {
    				name = field.Name
    			}
    
    			if requireCreate && !field.Creatable {
    				results[name] = false
    			} else if requireUpdate && !field.Updatable {
    				results[name] = false
    			}
    		}
    	}
    
    	return results, !notRestricted && len(stmt.Selects) > 0
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 19.8K bytes
    - Viewed (0)
  8. schema/field.go

    		field.Creatable = false
    		field.Updatable = false
    		if strings.ToLower(v) == "false" {
    			field.Readable = false
    		} else {
    			field.Readable = true
    		}
    	}
    
    	if v, ok := field.TagSettings["<-"]; ok {
    		field.Creatable = true
    		field.Updatable = true
    
    		if v != "<-" {
    			if !strings.Contains(v, "create") {
    				field.Creatable = false
    			}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 32K bytes
    - Viewed (1)
  9. schema/schema.go

    		}
    
    		bindName := field.BindName()
    		if field.DBName != "" {
    			// nonexistence or shortest path or first appear prioritized if has permission
    			if v, ok := schema.FieldsByDBName[field.DBName]; !ok || ((field.Creatable || field.Updatable || field.Readable) && len(field.BindNames) < len(v.BindNames)) {
    				if _, ok := schema.FieldsByDBName[field.DBName]; !ok {
    					schema.DBNames = append(schema.DBNames, field.DBName)
    				}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Oct 10 06:50:29 GMT 2023
    - 13.7K bytes
    - Viewed (0)
  10. schema/relationship.go

    		}
    	} else {
    		relation.JoinTable.Relationships.Relations[relRefName].References = []*Reference{}
    	}
    
    	// build references
    	for _, f := range relation.JoinTable.Fields {
    		if f.Creatable || f.Readable || f.Updatable {
    			// use same data type for foreign keys
    			if copyableDataType(fieldsMap[f.Name].DataType) {
    				f.DataType = fieldsMap[f.Name].DataType
    			}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 22.4K bytes
    - Viewed (0)
Back to top