From 9225074e57d195658025923a910db9b25ecc5a30 Mon Sep 17 00:00:00 2001 From: monsky Date: Thu, 29 May 2025 08:55:21 +0000 Subject: [PATCH] migartion, config/database, config --- .env | 25 +++++++ config/config.go | 47 ++++++++++++ config/database.go | 41 +++++++++++ .../000001_create_users_table.down.sql | 1 + .../000001_create_users_table.up.sql | 9 +++ ...000002_create_hero_sections_table.down.sql | 1 + .../000002_create_hero_sections_table.up.sql | 10 +++ ...0003_create_client_sections_table.down.sql | 1 + ...000003_create_client_sections_table.up.sql | 8 +++ .../000004_create_faq_sections_table.down.sql | 1 + .../000004_create_faq_sections_table.up.sql | 8 +++ ...0005_create_about_companies_table.down.sql | 1 + ...000005_create_about_companies_table.up.sql | 7 ++ ...eate_about_company_keynotes_table.down.sql | 1 + ...create_about_company_keynotes_table.up.sql | 11 +++ ...007_create_service_sections_table.down.sql | 1 + ...00007_create_service_sections_table.up.sql | 9 +++ .../000008_create_appointments_table.down.sql | 1 + .../000008_create_appointments_table.up.sql | 15 ++++ ..._create_portofolio_sections_table.down.sql | 1 + ...09_create_portofolio_sections_table.up.sql | 9 +++ ...0_create_portofolio_details_table.down.sql | 1 + ...010_create_portofolio_details_table.up.sql | 15 ++++ ...ate_portofolio_testimonials_table.down.sql | 1 + ...reate_portofolio_testimonials_table.up.sql | 13 ++++ .../000012_create_our_teams_table.down.sql | 1 + .../000012_create_our_teams_table.up.sql | 10 +++ .../000013_create_contact_us.down.sql | 1 + .../000013_create_contact_us.up.sql | 10 +++ ...0014_create_service_details_table.down.sql | 1 + ...000014_create_service_details_table.up.sql | 14 ++++ go.mod | 31 ++++++++ go.sum | 72 +++++++++++++++++++ 33 files changed, 378 insertions(+) create mode 100644 .env create mode 100644 config/config.go create mode 100644 config/database.go create mode 100644 database/migrations/000002_create_hero_sections_table.down.sql create mode 100644 database/migrations/000002_create_hero_sections_table.up.sql create mode 100644 database/migrations/000003_create_client_sections_table.down.sql create mode 100644 database/migrations/000003_create_client_sections_table.up.sql create mode 100644 database/migrations/000004_create_faq_sections_table.down.sql create mode 100644 database/migrations/000004_create_faq_sections_table.up.sql create mode 100644 database/migrations/000005_create_about_companies_table.down.sql create mode 100644 database/migrations/000005_create_about_companies_table.up.sql create mode 100644 database/migrations/000006_create_about_company_keynotes_table.down.sql create mode 100644 database/migrations/000006_create_about_company_keynotes_table.up.sql create mode 100644 database/migrations/000007_create_service_sections_table.down.sql create mode 100644 database/migrations/000007_create_service_sections_table.up.sql create mode 100644 database/migrations/000008_create_appointments_table.down.sql create mode 100644 database/migrations/000008_create_appointments_table.up.sql create mode 100644 database/migrations/000009_create_portofolio_sections_table.down.sql create mode 100644 database/migrations/000009_create_portofolio_sections_table.up.sql create mode 100644 database/migrations/000010_create_portofolio_details_table.down.sql create mode 100644 database/migrations/000010_create_portofolio_details_table.up.sql create mode 100644 database/migrations/000011_create_portofolio_testimonials_table.down.sql create mode 100644 database/migrations/000011_create_portofolio_testimonials_table.up.sql create mode 100644 database/migrations/000012_create_our_teams_table.down.sql create mode 100644 database/migrations/000012_create_our_teams_table.up.sql create mode 100644 database/migrations/000013_create_contact_us.down.sql create mode 100644 database/migrations/000013_create_contact_us.up.sql create mode 100644 database/migrations/000014_create_service_details_table.down.sql create mode 100644 database/migrations/000014_create_service_details_table.up.sql create mode 100644 go.sum diff --git a/.env b/.env new file mode 100644 index 0000000..c70659f --- /dev/null +++ b/.env @@ -0,0 +1,25 @@ +APP_ENV="development" +APP_PORT="8080" + +DATABASE_PORT=5432 +DATABASE_HOST=localhost +DATABASE_USER=teddybear +DATABASE_PASSWORD=Teddybear123 +DATABASE_NAME=blcompro +DATABASE_SSL_MODE=disable +DATABASE_MAX_OPEN_CONNECTION=10 +DATABASE_MAX_IDLE_CONNECTION=20 + +JWT_SECRET_KEY="secret" +JWT_ISSUER="secret" + +SUPABASE_STORAGE_URL= +SUPABASE_STORAGE_KEY= +SUPABASE_STORAGE_BUCKET= + +EMAIL_HOST= +EMAIL_USERNAME= +EMAIL_PASSWORD= +EMAIL_PORT=587 +EMAIL_TLS=true +EMAIL_RECEIVER="admin@bwacompro.com" \ No newline at end of file diff --git a/config/config.go b/config/config.go new file mode 100644 index 0000000..054e931 --- /dev/null +++ b/config/config.go @@ -0,0 +1,47 @@ +package config + +import "github.com/spf13/viper" + +type App struct { + AppPort string `json:"app_port"` + AppEnv string `json:"app_env"` + + JwtSecretKey string `json:"jwt_secret_key"` + JwtIssuer string `json:"jwt_issuer"` +} + +type PsqlDB struct { + Host string `json:"host"` + Port string `json:"port"` + User string `json:"user"` + Password string `json:"password"` + DBName string `json:"db_name"` + DBMaxOpen int `json:"db_max_open"` + DBMaxIdle int `json:"db_max_idle"` +} + +type Config struct { + App App + Psql PsqlDB +} + +func NewConfig() *Config { + return &Config{ + App: App{ + AppPort: viper.GetString("APP_PORT"), + AppEnv: viper.GetString("APP_PORT"), + + JwtSecretKey: viper.GetString("JWT_SECRET_KEY"), + JwtIssuer: viper.GetString("JWT_ISSUER"), + }, + Psql: PsqlDB{ + Host: viper.GetString("DATABASE_HOST"), + Port: viper.GetString("DATABASE_PORT"), + User: viper.GetString("DATABASE_USER"), + Password: viper.GetString("DATABASE_PASSWORD"), + DBName: viper.GetString("DATABASE_NAME"), + DBMaxOpen: viper.GetInt("DATABASE_MAX_OPEN_CONNECTION"), + DBMaxIdle: viper.GetInt("DATABASE_MAX_IDLE_CONNECTION"), + }, + } +} diff --git a/config/database.go b/config/database.go new file mode 100644 index 0000000..1842169 --- /dev/null +++ b/config/database.go @@ -0,0 +1,41 @@ +package config + +import ( + "fmt" + + "github.com/rs/zerolog/log" + "gorm.io/driver/postgres" + "gorm.io/gorm" +) + +type Postgres struct { + DB *gorm.DB +} + +func (cfg Config) ConnectionPostgres() (*Postgres, error) { + dbConnString := fmt.Sprintf("postgres://%s:%s@%s:%s/%s", + cfg.Psql.User, + cfg.Psql.Password, + cfg.Psql.Host, + cfg.Psql.Port, + cfg.Psql.DBName) + + db, err := gorm.Open(postgres.Open(dbConnString), &gorm.Config{}) + if err != nil { + log.Error().Err(err).Msg("[ConnectionPostgres-1] Failed to connect to database " + cfg.Psql.Host) + return nil, err + } + + sqlDB, err := db.DB() + if err != nil { + log.Error().Err(err).Msg("[ConnectionPostgres-2] Failed to get database connection") + return nil, err + } + + // seeds.SeedAdmin(db) + + sqlDB.SetMaxOpenConns(cfg.Psql.DBMaxOpen) + sqlDB.SetMaxIdleConns(cfg.Psql.DBMaxIdle) + + return &Postgres{DB: db}, nil +} diff --git a/database/migrations/000001_create_users_table.down.sql b/database/migrations/000001_create_users_table.down.sql index e69de29..fdf2916 100644 --- a/database/migrations/000001_create_users_table.down.sql +++ b/database/migrations/000001_create_users_table.down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS "users"; \ No newline at end of file diff --git a/database/migrations/000001_create_users_table.up.sql b/database/migrations/000001_create_users_table.up.sql index e69de29..ed30cdf 100644 --- a/database/migrations/000001_create_users_table.up.sql +++ b/database/migrations/000001_create_users_table.up.sql @@ -0,0 +1,9 @@ +CREATE TABLE IF NOT EXISTS "users" ( + id SERIAL PRIMARY KEY, + name VARCHAR(100) NOT NULL, + email VARCHAR(100) NOT NULL, + password VARCHAR(100) NOT NULL, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, + deleted_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP +); \ No newline at end of file diff --git a/database/migrations/000002_create_hero_sections_table.down.sql b/database/migrations/000002_create_hero_sections_table.down.sql new file mode 100644 index 0000000..c728d62 --- /dev/null +++ b/database/migrations/000002_create_hero_sections_table.down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS "hero_sections"; \ No newline at end of file diff --git a/database/migrations/000002_create_hero_sections_table.up.sql b/database/migrations/000002_create_hero_sections_table.up.sql new file mode 100644 index 0000000..c54ff06 --- /dev/null +++ b/database/migrations/000002_create_hero_sections_table.up.sql @@ -0,0 +1,10 @@ +CREATE TABLE IF NOT EXISTS hero_sections ( + id SERIAL PRIMARY KEY, + heading varchar(150), + sub_heading varchar(150), + path_video text NULL, + path_banner text NULL, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, + deleted_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP +); \ No newline at end of file diff --git a/database/migrations/000003_create_client_sections_table.down.sql b/database/migrations/000003_create_client_sections_table.down.sql new file mode 100644 index 0000000..11a510e --- /dev/null +++ b/database/migrations/000003_create_client_sections_table.down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS "client_section"; \ No newline at end of file diff --git a/database/migrations/000003_create_client_sections_table.up.sql b/database/migrations/000003_create_client_sections_table.up.sql new file mode 100644 index 0000000..eb6da3e --- /dev/null +++ b/database/migrations/000003_create_client_sections_table.up.sql @@ -0,0 +1,8 @@ +CREATE TABLE IF NOT EXISTS client_sections ( + id SERIAL PRIMARY KEY, + name varchar(150), + path_icon text NULL, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, + deleted_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP +); \ No newline at end of file diff --git a/database/migrations/000004_create_faq_sections_table.down.sql b/database/migrations/000004_create_faq_sections_table.down.sql new file mode 100644 index 0000000..b2ee0cf --- /dev/null +++ b/database/migrations/000004_create_faq_sections_table.down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS "faq_section"; \ No newline at end of file diff --git a/database/migrations/000004_create_faq_sections_table.up.sql b/database/migrations/000004_create_faq_sections_table.up.sql new file mode 100644 index 0000000..05b1861 --- /dev/null +++ b/database/migrations/000004_create_faq_sections_table.up.sql @@ -0,0 +1,8 @@ +CREATE TABLE IF NOT EXISTS faq_sections ( + id SERIAL PRIMARY KEY, + title varchar(255), + description text, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, + deleted_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP +); \ No newline at end of file diff --git a/database/migrations/000005_create_about_companies_table.down.sql b/database/migrations/000005_create_about_companies_table.down.sql new file mode 100644 index 0000000..6e747da --- /dev/null +++ b/database/migrations/000005_create_about_companies_table.down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS "about_companies"; \ No newline at end of file diff --git a/database/migrations/000005_create_about_companies_table.up.sql b/database/migrations/000005_create_about_companies_table.up.sql new file mode 100644 index 0000000..6c42c56 --- /dev/null +++ b/database/migrations/000005_create_about_companies_table.up.sql @@ -0,0 +1,7 @@ +CREATE TABLE IF NOT EXISTS about_companies ( + id SERIAL PRIMARY KEY, + description text, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, + deleted_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP +); \ No newline at end of file diff --git a/database/migrations/000006_create_about_company_keynotes_table.down.sql b/database/migrations/000006_create_about_company_keynotes_table.down.sql new file mode 100644 index 0000000..92a250f --- /dev/null +++ b/database/migrations/000006_create_about_company_keynotes_table.down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS "about_company_keynotes"; \ No newline at end of file diff --git a/database/migrations/000006_create_about_company_keynotes_table.up.sql b/database/migrations/000006_create_about_company_keynotes_table.up.sql new file mode 100644 index 0000000..db38ddc --- /dev/null +++ b/database/migrations/000006_create_about_company_keynotes_table.up.sql @@ -0,0 +1,11 @@ +CREATE TABLE IF NOT EXISTS about_company_keynotes ( + id SERIAL PRIMARY KEY, + about_company_id INT REFERENCES about_companies(id) ON DELETE CASCADE, + keypoint text, + path_image text null, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, + deleted_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP +); + +CREATE INDEX idx_about_company_keynotes_about_company_id ON about_company_keynotes(about_company_id); \ No newline at end of file diff --git a/database/migrations/000007_create_service_sections_table.down.sql b/database/migrations/000007_create_service_sections_table.down.sql new file mode 100644 index 0000000..122313b --- /dev/null +++ b/database/migrations/000007_create_service_sections_table.down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS "service_sections"; \ No newline at end of file diff --git a/database/migrations/000007_create_service_sections_table.up.sql b/database/migrations/000007_create_service_sections_table.up.sql new file mode 100644 index 0000000..5bd3629 --- /dev/null +++ b/database/migrations/000007_create_service_sections_table.up.sql @@ -0,0 +1,9 @@ +CREATE TABLE IF NOT EXISTS service_sections ( + id SERIAL PRIMARY KEY, + path_icon text, + name varchar(150), + tagline text null, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, + deleted_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP +); \ No newline at end of file diff --git a/database/migrations/000008_create_appointments_table.down.sql b/database/migrations/000008_create_appointments_table.down.sql new file mode 100644 index 0000000..9c8d3e5 --- /dev/null +++ b/database/migrations/000008_create_appointments_table.down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS "appointments"; \ No newline at end of file diff --git a/database/migrations/000008_create_appointments_table.up.sql b/database/migrations/000008_create_appointments_table.up.sql new file mode 100644 index 0000000..1fd0be8 --- /dev/null +++ b/database/migrations/000008_create_appointments_table.up.sql @@ -0,0 +1,15 @@ +CREATE TABLE IF NOT EXISTS appointments ( + id SERIAL PRIMARY KEY, + service_id INT REFERENCES service_sections(id) ON DELETE CASCADE, + name varchar(150), + phone_number varchar(15), + email varchar(150), + brief text, + meet_at timestamp NOT NULL, + budget DECIMAL(10,1) NOT NULL, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, + deleted_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP +); + +CREATE INDEX idx_appointments_service_id ON appointments(service_id); \ No newline at end of file diff --git a/database/migrations/000009_create_portofolio_sections_table.down.sql b/database/migrations/000009_create_portofolio_sections_table.down.sql new file mode 100644 index 0000000..9945697 --- /dev/null +++ b/database/migrations/000009_create_portofolio_sections_table.down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS "portofolio_sections"; \ No newline at end of file diff --git a/database/migrations/000009_create_portofolio_sections_table.up.sql b/database/migrations/000009_create_portofolio_sections_table.up.sql new file mode 100644 index 0000000..7ae8764 --- /dev/null +++ b/database/migrations/000009_create_portofolio_sections_table.up.sql @@ -0,0 +1,9 @@ +CREATE TABLE IF NOT EXISTS portofolio_sections ( + id SERIAL PRIMARY KEY, + name varchar(150), + tagline text, + thumbnail text null, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, + deleted_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP +); \ No newline at end of file diff --git a/database/migrations/000010_create_portofolio_details_table.down.sql b/database/migrations/000010_create_portofolio_details_table.down.sql new file mode 100644 index 0000000..eb83845 --- /dev/null +++ b/database/migrations/000010_create_portofolio_details_table.down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS "portofolio_details"; \ No newline at end of file diff --git a/database/migrations/000010_create_portofolio_details_table.up.sql b/database/migrations/000010_create_portofolio_details_table.up.sql new file mode 100644 index 0000000..9aacb9c --- /dev/null +++ b/database/migrations/000010_create_portofolio_details_table.up.sql @@ -0,0 +1,15 @@ +CREATE TABLE IF NOT EXISTS portofolio_details ( + id SERIAL PRIMARY KEY, + portofolio_section_id INT REFERENCES portofolio_sections(id) ON DELETE CASCADE, + category varchar(150), + client_name text, + project_date timestamp, + project_url text NULL, + title varchar(200), + description text, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, + deleted_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP +); + +CREATE INDEX idx_portofolio_details_portofolio_section_id ON portofolio_details(portofolio_section_id); \ No newline at end of file diff --git a/database/migrations/000011_create_portofolio_testimonials_table.down.sql b/database/migrations/000011_create_portofolio_testimonials_table.down.sql new file mode 100644 index 0000000..b49e6a2 --- /dev/null +++ b/database/migrations/000011_create_portofolio_testimonials_table.down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS "portofolio_testimonials"; \ No newline at end of file diff --git a/database/migrations/000011_create_portofolio_testimonials_table.up.sql b/database/migrations/000011_create_portofolio_testimonials_table.up.sql new file mode 100644 index 0000000..8cd2d59 --- /dev/null +++ b/database/migrations/000011_create_portofolio_testimonials_table.up.sql @@ -0,0 +1,13 @@ +CREATE TABLE IF NOT EXISTS portofolio_testimonials ( + id SERIAL PRIMARY KEY, + portofolio_section_id INT REFERENCES portofolio_sections(id) ON DELETE CASCADE, + client_name varchar(150), + thumbnail varchar(200), + message text, + role varchar(100), + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, + deleted_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP +); + +CREATE INDEX idx_portofolio_testimonials_portofolio_section_id ON portofolio_testimonials(portofolio_section_id); \ No newline at end of file diff --git a/database/migrations/000012_create_our_teams_table.down.sql b/database/migrations/000012_create_our_teams_table.down.sql new file mode 100644 index 0000000..6975fce --- /dev/null +++ b/database/migrations/000012_create_our_teams_table.down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS "our_teams"; \ No newline at end of file diff --git a/database/migrations/000012_create_our_teams_table.up.sql b/database/migrations/000012_create_our_teams_table.up.sql new file mode 100644 index 0000000..bd58444 --- /dev/null +++ b/database/migrations/000012_create_our_teams_table.up.sql @@ -0,0 +1,10 @@ +CREATE TABLE IF NOT EXISTS our_teams ( + id SERIAL PRIMARY KEY, + name varchar(150), + path_photo text, + role varchar(100), + tagline text, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, + deleted_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP +); \ No newline at end of file diff --git a/database/migrations/000013_create_contact_us.down.sql b/database/migrations/000013_create_contact_us.down.sql new file mode 100644 index 0000000..a29b238 --- /dev/null +++ b/database/migrations/000013_create_contact_us.down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS "contact_us"; \ No newline at end of file diff --git a/database/migrations/000013_create_contact_us.up.sql b/database/migrations/000013_create_contact_us.up.sql new file mode 100644 index 0000000..ff72ab3 --- /dev/null +++ b/database/migrations/000013_create_contact_us.up.sql @@ -0,0 +1,10 @@ +CREATE TABLE IF NOT EXISTS contact_us ( + id SERIAL PRIMARY KEY, + company_name VARCHAR(150) NOT NULL, + location_name varchar(150), + address text, + phone_number varchar(17), + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, + deleted_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP +); \ No newline at end of file diff --git a/database/migrations/000014_create_service_details_table.down.sql b/database/migrations/000014_create_service_details_table.down.sql new file mode 100644 index 0000000..411cc86 --- /dev/null +++ b/database/migrations/000014_create_service_details_table.down.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS "service_details"; \ No newline at end of file diff --git a/database/migrations/000014_create_service_details_table.up.sql b/database/migrations/000014_create_service_details_table.up.sql new file mode 100644 index 0000000..fbe527a --- /dev/null +++ b/database/migrations/000014_create_service_details_table.up.sql @@ -0,0 +1,14 @@ +CREATE TABLE IF NOT EXISTS service_details ( + id SERIAL PRIMARY KEY, + service_id INT REFERENCES service_sections(id) ON DELETE CASCADE, + path_image text NOT NULL, + title varchar(255) NOT NULL, + description text NOT NULL, + path_pdf text NULL, + path_docx text NULL, + created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, + deleted_at TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP +); + +CREATE INDEX idx_service_details_service_id ON service_details(service_id); \ No newline at end of file diff --git a/go.mod b/go.mod index f4400f9..aa03784 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,34 @@ module blcompro go 1.22.2 + +require ( + github.com/fsnotify/fsnotify v1.8.0 // indirect + github.com/go-viper/mapstructure/v2 v2.2.1 // indirect + github.com/jackc/pgpassfile v1.0.0 // indirect + github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect + github.com/jackc/pgx/v5 v5.6.0 // indirect + github.com/jackc/puddle/v2 v2.2.2 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect + github.com/mattn/go-colorable v0.1.13 // indirect + github.com/mattn/go-isatty v0.0.19 // indirect + github.com/pelletier/go-toml/v2 v2.2.3 // indirect + github.com/rs/zerolog v1.34.0 // indirect + github.com/sagikazarmark/locafero v0.7.0 // indirect + github.com/sourcegraph/conc v0.3.0 // indirect + github.com/spf13/afero v1.12.0 // indirect + github.com/spf13/cast v1.7.1 // indirect + github.com/spf13/pflag v1.0.6 // indirect + github.com/spf13/viper v1.20.1 // indirect + github.com/subosito/gotenv v1.6.0 // indirect + go.uber.org/atomic v1.9.0 // indirect + go.uber.org/multierr v1.9.0 // indirect + golang.org/x/crypto v0.32.0 // indirect + golang.org/x/sync v0.10.0 // indirect + golang.org/x/sys v0.29.0 // indirect + golang.org/x/text v0.21.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + gorm.io/driver/postgres v1.6.0 // indirect + gorm.io/gorm v1.30.0 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..db40126 --- /dev/null +++ b/go.sum @@ -0,0 +1,72 @@ +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/fsnotify/fsnotify v1.8.0 h1:dAwr6QBTBZIkG8roQaJjGof0pp0EeF+tNV7YBP3F/8M= +github.com/fsnotify/fsnotify v1.8.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss= +github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM= +github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 h1:iCEnooe7UlwOQYpKFhBabPMi4aNAfoODPEFNiAnClxo= +github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761/go.mod h1:5TJZWKEWniPve33vlWYSoGYefn3gLQRzjfDlhSJ9ZKM= +github.com/jackc/pgx/v5 v5.6.0 h1:SWJzexBzPL5jb0GEsrPMLIsi/3jOo7RHlzTjcAeDrPY= +github.com/jackc/pgx/v5 v5.6.0/go.mod h1:DNZ/vlrUnhWCoFGxHAG8U2ljioxukquj7utPDgtQdTw= +github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo= +github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= +github.com/jinzhu/inflection v1.0.0 h1:K317FqzuhWc8YvSVlFMCCUb36O/S9MCKRDI7QkRKD/E= +github.com/jinzhu/inflection v1.0.0/go.mod h1:h+uFLlag+Qp1Va5pdKtLDYj+kHp5pxUVkryuEj+Srlc= +github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= +github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= +github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= +github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M= +github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rs/xid v1.6.0/go.mod h1:7XoLgs4eV+QndskICGsho+ADou8ySMSjJKDIan90Nz0= +github.com/rs/zerolog v1.34.0 h1:k43nTLIwcTVQAncfCw4KZ2VY6ukYoZaBPNOE8txlOeY= +github.com/rs/zerolog v1.34.0/go.mod h1:bJsvje4Z08ROH4Nhs5iH600c3IkWhwp44iRc54W6wYQ= +github.com/sagikazarmark/locafero v0.7.0 h1:5MqpDsTGNDhY8sGp0Aowyf0qKsPrhewaLSsFaodPcyo= +github.com/sagikazarmark/locafero v0.7.0/go.mod h1:2za3Cg5rMaTMoG/2Ulr9AwtFaIppKXTRYnozin4aB5k= +github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= +github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= +github.com/spf13/afero v1.12.0 h1:UcOPyRBYczmFn6yvphxkn9ZEOY65cpwGKb5mL36mrqs= +github.com/spf13/afero v1.12.0/go.mod h1:ZTlWwG4/ahT8W7T0WQ5uYmjI9duaLQGy3Q2OAl4sk/4= +github.com/spf13/cast v1.7.1 h1:cuNEagBQEHWN1FnbGEjCXL2szYEXqfJPbP2HNUaca9Y= +github.com/spf13/cast v1.7.1/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= +github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/viper v1.20.1 h1:ZMi+z/lvLyPSCoNtFCpqjy0S4kPbirhpTMwl8BkW9X4= +github.com/spf13/viper v1.20.1/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= +github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU= +go.uber.org/atomic v1.9.0 h1:ECmE8Bn/WFTYwEW/bpKD3M8VtR/zQVbavAoalC1PYyE= +go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= +go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= +golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= +golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ= +golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gorm.io/driver/postgres v1.6.0 h1:2dxzU8xJ+ivvqTRph34QX+WrRaJlmfyPqXmoGVjMBa4= +gorm.io/driver/postgres v1.6.0/go.mod h1:vUw0mrGgrTK+uPHEhAdV4sfFELrByKVGnaVRkXDhtWo= +gorm.io/gorm v1.30.0 h1:qbT5aPv1UH8gI99OsRlvDToLxW5zR7FzS9acZDOZcgs= +gorm.io/gorm v1.30.0/go.mod h1:8Z33v652h4//uMA76KjeDH8mJXPm1QNCYrMeatR0DOE=