mirror of
				https://github.com/juanfont/headscale.git
				synced 2025-10-28 10:51:44 +01:00 
			
		
		
		
	Merge pull request #303 from kradalby/migrate_ipaddresses
This commit is contained in:
		
						commit
						e05c5e0b93
					
				
							
								
								
									
										8
									
								
								db.go
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								db.go
									
									
									
									
									
								
							@ -28,20 +28,26 @@ func (h *Headscale) initDB() error {
 | 
				
			|||||||
	h.db = db
 | 
						h.db = db
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if h.dbType == Postgres {
 | 
						if h.dbType == Postgres {
 | 
				
			||||||
		db.Exec("create extension if not exists \"uuid-ossp\";")
 | 
							db.Exec(`create extension if not exists "uuid-ossp";`)
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						_ = db.Migrator().RenameColumn(&Machine{}, "ip_address", "ip_addresses")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = db.AutoMigrate(&Machine{})
 | 
						err = db.AutoMigrate(&Machine{})
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return err
 | 
							return err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = db.AutoMigrate(&KV{})
 | 
						err = db.AutoMigrate(&KV{})
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return err
 | 
							return err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = db.AutoMigrate(&Namespace{})
 | 
						err = db.AutoMigrate(&Namespace{})
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return err
 | 
							return err
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	err = db.AutoMigrate(&PreAuthKey{})
 | 
						err = db.AutoMigrate(&PreAuthKey{})
 | 
				
			||||||
	if err != nil {
 | 
						if err != nil {
 | 
				
			||||||
		return err
 | 
							return err
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user