refactor: Rename tables
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -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 {
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user