File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed
Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 5757 <groupId >org.springframework.boot</groupId >
5858 <artifactId >spring-boot-starter-validation</artifactId >
5959 </dependency >
60+ <dependency >
61+ <groupId >org.flywaydb</groupId >
62+ <artifactId >flyway-core</artifactId >
63+ </dependency >
64+ <dependency >
65+ <groupId >org.flywaydb</groupId >
66+ <artifactId >flyway-database-postgresql</artifactId >
67+ </dependency >
6068 </dependencies >
6169
6270 <build >
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ spring.datasource.username=amigoscode
44spring.datasource.password =
55spring.datasource.driver-class-name =org.postgresql.Driver
66
7- spring.jpa.hibernate.ddl-auto =create-drop
7+ spring.jpa.hibernate.ddl-auto =validate
88spring.jpa.show-sql =true
99spring.jpa.properties.hibernate.format_sql =true
1010
Original file line number Diff line number Diff line change 1+ CREATE EXTENSION IF NOT EXISTS " uuid-ossp" ;
2+
3+ CREATE TABLE IF NOT EXISTS product (
4+ id UUID PRIMARY KEY DEFAULT uuid_generate_v4(),
5+ name VARCHAR (50 ) NOT NULL CHECK (char_length(name) > 1 ),
6+ description VARCHAR (500 ) CHECK (char_length(description) >= 5 ),
7+ price NUMERIC (10 , 2 ) NOT NULL CHECK (price > 0 ),
8+ image_url VARCHAR (200 ) CHECK (char_length(image_url) > 0 ),
9+ stock_level INT NOT NULL DEFAULT 1 CHECK (stock_level >= 0 ),
10+ created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
11+ updated_at TIMESTAMPTZ DEFAULT NOW(),
12+ deleted_at TIMESTAMPTZ
13+ );
You can’t perform that action at this time.
0 commit comments