V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
longmeier90
V2EX  ›  Go 编程语言

请教一个 gorm 的数据库表结构管理问题?

  •  
  •   longmeier90 · 16 天前 · 1050 次点击
    有没有什么工具能够像 django 那种 makemigrations ,对表字段更改做一个详细记录和管理。
    总感觉 gorm ,automigrate 这种操作很容易出问题。
    8 条回复    2024-09-05 10:15:18 +08:00
    DesnLee
        1
    DesnLee  
       16 天前
    我用的 sqlc
    DesnLee
        2
    DesnLee  
       16 天前
    @DesnLee 写 sql 配 golang-migrate
    SimbaPeng
        3
    SimbaPeng  
       16 天前
    atlas
    longmeier90
        4
    longmeier90  
    OP
       16 天前
    @DesnLee 能不能根据自己定义的 model struct 来生成
    ninjashixuan
        5
    ninjashixuan  
       16 天前
    不用太担心,automigrate 没有不会删除字段。
    xingjue
        6
    xingjue  
       16 天前
    你说的是 laravel 那种版本管理的 migrate?
    saibotan
        7
    saibotan  
       15 天前
    https://bun.uptrace.dev/ 在尝试这个
    gvison
        8
    gvison  
       14 天前
    根据 sql 逆向生成对应 gorm 的 model 、CRUD ,会更加的省事, 例如 https://go-sponge.com/ui/web-dao
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2403 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 23ms · UTC 15:53 · PVG 23:53 · LAX 08:53 · JFK 11:53
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.