refactor: Rename tables

This commit is contained in:
2025-08-19 20:38:33 +03:00
parent b59b5897fb
commit 4e186de981
4 changed files with 7 additions and 6 deletions

View File

@@ -1,5 +1,5 @@
-- +goose Up -- +goose Up
create table if not exists service create table if not exists services
( (
id bigserial primary key, id bigserial primary key,
name varchar(255) not null, name varchar(255) not null,
@@ -11,4 +11,4 @@ create table if not exists service
public boolean default false public boolean default false
); );
-- +goose Down -- +goose Down
drop table if exists service; drop table if exists services;

View File

@@ -1,5 +1,5 @@
-- +goose Up -- +goose Up
create table status create table statuses
( (
id bigserial primary key, id bigserial primary key,
service_id bigint, service_id bigint,
@@ -7,7 +7,8 @@ create table status
created_at timestamp with time zone, created_at timestamp with time zone,
description varchar(255), description varchar(255),
constraint fk_service_statuses FOREIGN KEY (service_id) references service (id) constraint fk_service_statuses FOREIGN KEY (service_id) references services (id)
); );
-- +goose Down -- +goose Down
drop table if exists statuses;

View File

@@ -31,7 +31,7 @@ type Service struct {
} }
func (Service) TableName() string { func (Service) TableName() string {
return "service" return "services"
} }
func (s Service) CountLastStatuses(status StatusCode) uint { func (s Service) CountLastStatuses(status StatusCode) uint {

View File

@@ -23,7 +23,7 @@ type Status struct {
} }
func (Status) TableName() string { func (Status) TableName() string {
return "status" return "statuses"
} }
func (s *Status) BeforeCreate(*gorm.DB) error { func (s *Status) BeforeCreate(*gorm.DB) error {