From fb9985d6f0811bc3c1c04803d6fe5889bcd023f0 Mon Sep 17 00:00:00 2001 From: divyam234 Date: Mon, 11 Sep 2023 11:40:03 +0530 Subject: [PATCH] modify constraint --- database/migrations/20230911113331_alter_table.sql | 8 ++++++++ main.go | 5 +++-- ui/teldrive-ui | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 database/migrations/20230911113331_alter_table.sql diff --git a/database/migrations/20230911113331_alter_table.sql b/database/migrations/20230911113331_alter_table.sql new file mode 100644 index 0000000..3685db2 --- /dev/null +++ b/database/migrations/20230911113331_alter_table.sql @@ -0,0 +1,8 @@ +-- +goose Up +-- +goose StatementBegin + +ALTER TABLE teldrive.files DROP CONSTRAINT unique_file; + +ALTER TABLE teldrive.files ADD CONSTRAINT unique_file UNIQUE (name, parent_id, user_id,status) + +-- +goose StatementEnd \ No newline at end of file diff --git a/main.go b/main.go index 6361e48..ab77b8f 100644 --- a/main.go +++ b/main.go @@ -39,7 +39,9 @@ func main() { scheduler := gocron.NewScheduler(time.UTC) - scheduler.Every(1).Hours().Do(cron.FilesDeleteJob) + scheduler.Every(1).Hour().Do(cron.FilesDeleteJob) + + scheduler.StartAsync() router.Use(cors.New(cors.Config{ AllowMethods: []string{"GET", "POST", "PUT", "PATCH", "DELETE", "HEAD", "OPTIONS"}, @@ -67,5 +69,4 @@ func main() { } else { router.Run(fmt.Sprintf(":%d", config.Port)) } - scheduler.StartAsync() } diff --git a/ui/teldrive-ui b/ui/teldrive-ui index ee2f728..06f9a8b 160000 --- a/ui/teldrive-ui +++ b/ui/teldrive-ui @@ -1 +1 @@ -Subproject commit ee2f728020786599f2f6c9a4ab86f493b0ca19a7 +Subproject commit 06f9a8b4cac51b199d8fab8be781461d51d8b876