Skip to content

Commit

Permalink
🐛 Remove lockers definition (#380)
Browse files Browse the repository at this point in the history
  • Loading branch information
tosone authored Jun 23, 2024
1 parent c858974 commit ed67cc1
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 400 deletions.
1 change: 0 additions & 1 deletion pkg/dal/cmd/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ func main() {
models.Builder{},
models.BuilderRunner{},
models.WorkQueue{},
models.Locker{},
models.Setting{},
models.DaemonGcTagRule{},
models.DaemonGcTagRunner{},
Expand Down
6 changes: 0 additions & 6 deletions pkg/dal/dal.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (

"github.com/go-sigma/sigma/pkg/configs"
"github.com/go-sigma/sigma/pkg/consts"
"github.com/go-sigma/sigma/pkg/dal/models"
"github.com/go-sigma/sigma/pkg/dal/query"
"github.com/go-sigma/sigma/pkg/logger"
"github.com/go-sigma/sigma/pkg/modules/locker"
Expand Down Expand Up @@ -64,11 +63,6 @@ func Initialize(config configs.Configuration) error {
query.SetDefault(DB)
}

err = DB.AutoMigrate(&models.Locker{})
if err != nil {
return err
}

ctx, ctxCancel := context.WithCancel(context.Background())
defer ctxCancel()
err = locker.Locker.AcquireWithRenew(ctx, consts.LockerMigration, time.Second*3, time.Second*5)
Expand Down
14 changes: 2 additions & 12 deletions pkg/dal/migrations/mysql/0003_upgrade.up.sql
Original file line number Diff line number Diff line change
@@ -1,16 +1,6 @@
CREATE TABLE IF NOT EXISTS `lockers` (
`id` bigint AUTO_INCREMENT PRIMARY KEY,
`key` varchar(256) NOT NULL,
`value` varchar(256) NOT NULL,
`expire` bigint NOT NULL DEFAULT 0,
`created_at` bigint NOT NULL DEFAULT (UNIX_TIMESTAMP (CURRENT_TIMESTAMP()) * 1000),
`updated_at` bigint NOT NULL DEFAULT (UNIX_TIMESTAMP (CURRENT_TIMESTAMP()) * 1000),
`deleted_at` bigint NOT NULL DEFAULT 0,
CONSTRAINT `idx_lockers_key` UNIQUE (`key`, `deleted_at`)
);

ALTER TABLE `artifacts`
ADD COLUMN `namespace_id` bigint NOT NULL AFTER `id`;

ALTER TABLE `artifacts`
ADD CONSTRAINT FOREIGN KEY (`namespace_id`) REFERENCES `namespaces` (`id`)
ADD CONSTRAINT FOREIGN KEY (`namespace_id`) REFERENCES `namespaces` (`id`);

11 changes: 0 additions & 11 deletions pkg/dal/migrations/postgresql/0003_upgrade.up.sql
Original file line number Diff line number Diff line change
@@ -1,11 +0,0 @@
CREATE TABLE IF NOT EXISTS "lockers" (
"id" bigserial PRIMARY KEY,
"key" varchar(256) NOT NULL,
"value" varchar(256) NOT NULL,
"expire" bigint NOT NULL DEFAULT 0,
"created_at" bigint NOT NULL DEFAULT ((EXTRACT(EPOCH FROM CURRENT_TIMESTAMP) * 1000)::bigint),
"updated_at" bigint NOT NULL DEFAULT ((EXTRACT(EPOCH FROM CURRENT_TIMESTAMP) * 1000)::bigint),
"deleted_at" bigint NOT NULL DEFAULT 0,
CONSTRAINT "idx_lockers_key" UNIQUE ("key", "deleted_at")
);

11 changes: 0 additions & 11 deletions pkg/dal/migrations/sqlite3/0003_upgrade.up.sql
Original file line number Diff line number Diff line change
@@ -1,11 +0,0 @@
CREATE TABLE IF NOT EXISTS `lockers` (
`id` integer PRIMARY KEY AUTOINCREMENT,
`key` varchar(256) NOT NULL,
`value` varchar(256) NOT NULL,
`expire` integer NOT NULL DEFAULT 0,
`created_at` integer NOT NULL DEFAULT (unixepoch () * 1000),
`updated_at` integer NOT NULL DEFAULT (unixepoch () * 1000),
`deleted_at` integer NOT NULL DEFAULT 0,
CONSTRAINT `idx_lockers_key` UNIQUE (`key`, `deleted_at`)
);

8 changes: 0 additions & 8 deletions pkg/dal/query/gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ed67cc1

Please sign in to comment.