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

Migrations that begin with the year 2024 fail during the 'up' migration process #1024

Open
alazarbeyenenew2 opened this issue Jan 3, 2024 · 7 comments
Labels
duplicate This issue or pull request already exists

Comments

@alazarbeyenenew2
Copy link

Describe the Bug
Migrations that begin with the year 2024 fail during the 'up' migration process.

Steps to Reproduce

  1. run migration create
    migrate create -ext sql -dir internal/constant/query/schemas -tz "UTC"_sql_name
  2. run migrate up
    3

Expected Behavior

`User
panic: suint(-2077783112) expects input >= 0

goroutine 54 [running]:
github.com/golang-migrate/migrate/v4.suint(...)
github.com/golang-migrate/migrate/v4/util.go:45
github.com/golang-migrate/migrate/v4.(*Migrate).readUp(0xd1e9d40, 0xffffffff, 0xffffffff, 0xd294340)
github.com/golang-migrate/migrate/v4/migrate.go:582 +0x6be
created by github.com/golang-migrate/migrate/v4.(*Migrate).Up in goroutine 1
github.com/golang-migrate/migrate/v4/migrate.go:283 +0xea
make: [Makefile:4: migrate-up] Error 2 (ignored)`

Migrate Version
e.g. v3.4.15, v3.4.17

Loaded Source Drivers
e.g. s3, github, go-bindata, gcs, file
Obtained by running: migrate -help

Loaded Database Drivers
e.g. postgresql

Stacktrace

`User
panic: suint(-2077783112) expects input >= 0

goroutine 54 [running]:
github.com/golang-migrate/migrate/v4.suint(...)
github.com/golang-migrate/migrate/v4/util.go:45
github.com/golang-migrate/migrate/v4.(*Migrate).readUp(0xd1e9d40, 0xffffffff, 0xffffffff, 0xd294340)
github.com/golang-migrate/migrate/v4/migrate.go:582 +0x6be
created by github.com/golang-migrate/migrate/v4.(*Migrate).Up in goroutine 1
github.com/golang-migrate/migrate/v4/migrate.go:283 +0xea
make: [Makefile:4: migrate-up] Error 2 (ignored)`

@edsonjuniordev
Copy link

I have the same problem

@alazarbeyenenew2
Copy link
Author

I solved the problem by manually changing the year to 2023

@dhui
Copy link
Member

dhui commented Jan 12, 2024

suint(-2077783112) looks like an overflow. Are you on a 32-bit system?
See also:

@dhui dhui added the duplicate This issue or pull request already exists label Jan 12, 2024
@edsonjuniordev
Copy link

edsonjuniordev commented Jan 12, 2024

I'm using a 64-bit system. And the problem started to occur in 2024.

@alazarbeyenenew2
Copy link
Author

i am on 64-bit but this is this is started 2024 this is how i identify the problem then try to solve in my way

@oitan
Copy link

oitan commented Jan 19, 2024

y2k never ended

@mateusfmello
Copy link

I'm having the same problem.

I believe the quickest solution to this would be to migrate away from timestamps and use the sequential option.

However, I see that it is a complex thing to do because in addition to having to change all the migration files, you also have to update the database.

Looking at the database I have, the schema_migrations table only has one version line, but it is a version code that does not exist in my migrations. I think it might be the time stamp of the last run, but I'm not sure and I don't see much point in it. In Doctrine, which I am more accustomed to using, as I am migrating from PHP to GoLang, it stores all executed migrations, that is, each migration after being executed becomes a row in the schema_migrations table.

If someone can guide me on how Migrate works with the schema_migrations table, I can write a script to facilitate the migration of the timestamp to 6-digit sequential order, which is the default for migrate create -seq.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

5 participants