db: create user table
This commit is contained in:
parent
8e14ccd12a
commit
b9d4a58d71
1
.gitignore
vendored
1
.gitignore
vendored
@ -24,3 +24,4 @@ go.work.sum
|
|||||||
|
|
||||||
# Custom
|
# Custom
|
||||||
/_output
|
/_output
|
||||||
|
/deployment/db_data
|
||||||
|
@ -195,3 +195,5 @@ type User struct {
|
|||||||
ID int
|
ID int
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Use Buffalo pop `Soda CLI` to create database migrations.
|
||||||
|
7
database.yml
Normal file
7
database.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
development:
|
||||||
|
dialect: postgres
|
||||||
|
database: howmuch
|
||||||
|
user: postgres
|
||||||
|
password: example
|
||||||
|
host: 127.0.0.1
|
||||||
|
pool: 5
|
22
deployment/docker-compose.yml
Normal file
22
deployment/docker-compose.yml
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
services:
|
||||||
|
|
||||||
|
postgres:
|
||||||
|
image: postgres
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- "5432:5432"
|
||||||
|
deploy:
|
||||||
|
mode: replicated
|
||||||
|
replicas: 1
|
||||||
|
environment:
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: example
|
||||||
|
POSTGRES_DB: howmuch
|
||||||
|
volumes:
|
||||||
|
- ./db_data/postgres/:/var/lib/postgresql/data
|
||||||
|
|
||||||
|
adminer:
|
||||||
|
image: adminer
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- 8080:8080
|
@ -0,0 +1,3 @@
|
|||||||
|
DROP TABLE IF EXISTS "user";
|
||||||
|
DROP SEQUENCE IF EXISTS user_id_seq;
|
||||||
|
|
14
migrations/20241004191351_create_user_table.postgres.up.sql
Normal file
14
migrations/20241004191351_create_user_table.postgres.up.sql
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
CREATE SEQUENCE user_id_seq INCREMENT 1 MINVALUE 1 MAXVALUE 2147483647 CACHE 1;
|
||||||
|
|
||||||
|
CREATE TABLE "public"."user" (
|
||||||
|
"id" integer DEFAULT nextval('user_id_seq') NOT NULL,
|
||||||
|
"email" character varying(255) NOT NULL UNIQUE,
|
||||||
|
"first_name" character varying(255) NOT NULL,
|
||||||
|
"last_name" character varying(255) NOT NULL,
|
||||||
|
"password" character varying(60) NOT NULL,
|
||||||
|
"created_at" timestamp NOT NULL,
|
||||||
|
"updated_at" timestamp NOT NULL,
|
||||||
|
CONSTRAINT "user_pkey" PRIMARY KEY ("id")
|
||||||
|
) WITH (oids = false);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user