Compare commits

..

No commits in common. "55ee2bccbc79bcfb7e8cafa3271dda86e8b4b998" and "9a51201678e17f6c8f644bd4a59d8602aaf2ae14" have entirely different histories.

8 changed files with 6 additions and 64 deletions

2
.vscode/launch.json vendored
View File

@ -1,7 +1,7 @@
{
"configurations": [
{
"name": "Launch",
"name": "Launch eparser",
"type": "go",
"request": "launch",
"mode": "debug",

View File

@ -7,22 +7,11 @@ ifeq (local-migrations-create,$(firstword $(MAKECMDGOALS)))
endif
local-migrate-up:
@goose -allow-missing -dir ./migrations postgres "user=crab password=crab dbname=smm-core host=localhost port=5432 sslmode=disable" up
@goose -allow-missing -dir ./migrations postgres "user=crab dbname=smm-core host=localhost port=5432 sslmode=disable" up
local-migrations-create:
@goose -dir ./migrations postgres "user=crab dbname=smm-core host=localhost port=5432 sslmode=disable" create "${migrationName}" sql
local-up:
docker-compose -f docker-compose-local.yml up -d --force-recreate --build
local-down:
docker-compose -f docker-compose-local.yml down
local-wait_db:
timeout 10s bash -c "until docker exec db pg_isready; do sleep 1; done"
local-restart: local-down local-up local-wait_db local-migrate-up
local-go-init: export GOBIN := $(LOCAL_BIN)
local-go-init:
go get github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway
@ -34,7 +23,6 @@ local-go-init:
github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 \
google.golang.org/protobuf/cmd/protoc-gen-go \
google.golang.org/grpc/cmd/protoc-gen-go-grpc
go install github.com/pressly/goose/v3/cmd/goose@latest
generate:
rm -rf proto resources

View File

@ -1,22 +0,0 @@
version: '3.9'
services:
db:
container_name: db
image: postgres
restart: always
shm_size: 128mb
environment:
POSTGRES_USER: crab
POSTGRES_PASSWORD: crab
POSTGRES_DB: smm-core
ports:
- 5432:5432
adminer:
container_name: adminer
image: adminer
restart: always
ports:
- 8100:8080

View File

@ -12,4 +12,4 @@ services:
networks:
common-network:
external: true
external: true

4
go.mod
View File

@ -6,7 +6,7 @@ require (
github.com/grpc-ecosystem/grpc-gateway/v2 v2.23.0
google.golang.org/genproto/googleapis/api v0.0.0-20241021214115-324edc3d5d38
google.golang.org/grpc v1.67.1
google.golang.org/protobuf v1.35.2
google.golang.org/protobuf v1.35.1
)
require (
@ -14,6 +14,4 @@ require (
golang.org/x/sys v0.24.0 // indirect
golang.org/x/text v0.19.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 // indirect
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

7
go.sum
View File

@ -14,12 +14,5 @@ google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 h1:
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38/go.mod h1:GX3210XPVPUjJbTUbvwI8f2IpZDMZuPJWDzDuebbviI=
google.golang.org/grpc v1.67.1 h1:zWnc1Vrcno+lHZCOofnIMvycFcc0QRGIzm9dhnDX68E=
google.golang.org/grpc v1.67.1/go.mod h1:1gLDyUQU7CTLJI90u3nXZ9ekeghjeM7pTDZlqFNg2AA=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1 h1:F29+wU6Ee6qgu9TddPgooOdaqsxTMunOoj8KA5yuS5A=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.5.1/go.mod h1:5KF+wpkbTSbGcR9zteSqZV6fqFOWBl4Yde8En8MryZA=
google.golang.org/protobuf v1.35.1 h1:m3LfL6/Ca+fqnjnlqQXNpFPABW1UD7mjh8KO2mKFytA=
google.golang.org/protobuf v1.35.1/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
google.golang.org/protobuf v1.35.2 h1:8Ar7bF+apOIoThw1EdZl0p1oWvMqTHmpA2fRTyZO8io=
google.golang.org/protobuf v1.35.2/go.mod h1:9fA7Ob0pmnwhb644+1+CVWFRbNajQ6iRojtC/QF5bRE=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@ -1,6 +1,6 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE IF NOT EXISTS users (
CREATE TABLE IF NOT EXISTS "user" (
id SERIAL PRIMARY KEY,
chat_id TEXT NOT NULL
);
@ -8,5 +8,5 @@ CREATE TABLE IF NOT EXISTS users (
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS users;
DROP TABLE IF EXISTS "user";
-- +goose StatementEnd

View File

@ -1,15 +0,0 @@
-- +goose Up
-- +goose StatementBegin
CREATE TABLE IF NOT EXISTS categories (
id SERIAL PRIMARY KEY,
name TEXT NOT NULL,
user_id INT REFERENCES users(id),
favorite BOOLEAN DEFAULT FALSE,
monthly_limit INT DEFAULT 0
);
-- +goose StatementEnd
-- +goose Down
-- +goose StatementBegin
DROP TABLE IF EXISTS categories;
-- +goose StatementEnd